samples/sidemeanings/test/org/apidesign/sidemeanings/math/ArithmeticaTest.java
author Jaroslav Tulach <jtulach@netbeans.org>
Fri, 27 Mar 2009 20:30:39 +0100
changeset 325 4553c2885ce6
permissions -rw-r--r--
Arithmetica example with fuzzy modifiers eliminated
     1 /*
     2  * To change this template, choose Tools | Templates
     3  * and open the template in the editor.
     4  */
     5 
     6 package org.apidesign.sidemeanings.math;
     7 
     8 import org.junit.Before;
     9 import org.junit.Test;
    10 import static org.junit.Assert.*;
    11 
    12 /**
    13  *
    14  * @author Jaroslav Tulach <jtulach@netbeans.org>
    15  */
    16 public class ArithmeticaTest {
    17     Arithmetica instance;
    18 
    19     public ArithmeticaTest() {
    20     }
    21 
    22     @Before
    23     public void setUp() {
    24         instance = Arithmetica.create();
    25     }
    26 
    27     @Test
    28     public void testSumTwo() {
    29         assertEquals("+", 5, instance.sumTwo(3, 2));
    30     }
    31 
    32     @Test
    33     public void testSumAll() {
    34         assertEquals("+", 6, instance.sumAll(3, 2, 1));
    35     }
    36 
    37     @Test
    38     public void testSumRange() {
    39         assertEquals("1+2+3=6", 6, instance.sumRange(1, 3));
    40         assertEquals("sum(1,10)=55", 55, instance.sumRange(1, 10));
    41         assertEquals("sum(1,1)=1", 1, instance.sumRange(1, 1));
    42         assertEquals("sum(10,1)=55", 55, instance.sumRange(10, 1));
    43     }
    44 }