samples/composition/src-test/api/ArithmeticaTest.java
author Jaroslav Tulach <jtulach@netbeans.org>
Sat, 14 Jun 2008 10:04:53 +0200
changeset 210 acf2c31e22d4
parent 209 1c999569643b
child 235 cfcf2129865f
permissions -rw-r--r--
Merge: Geertjan's changes to the end of the chapter
     1 package api;
     2 
     3 import junit.framework.TestCase;
     4 
     5 /**
     6  *
     7  * @author Jaroslav Tulach <jtulach@netbeans.org>
     8  */
     9 public class ArithmeticaTest extends TestCase {
    10     
    11     public ArithmeticaTest(String testName) {
    12         super(testName);
    13     }            
    14 
    15     @Override
    16     protected void setUp() throws Exception {
    17         super.setUp();
    18     }
    19 
    20     @Override
    21     protected void tearDown() throws Exception {
    22         super.tearDown();
    23     }
    24 
    25     //BEGIN: design.composition.arith.test
    26     public void testSumTwo() {
    27         Arithmetica instance = new Arithmetica();
    28         assertEquals("+", 5, instance.sumTwo(3, 2));
    29     }
    30 
    31     public void testSumAll() {
    32         Arithmetica instance = new Arithmetica();
    33         assertEquals("+", 6, instance.sumAll(3, 2, 1));
    34     }
    35 
    36     public void testSumRange() {
    37         Arithmetica instance = new Arithmetica();
    38         assertEquals("1+2+3=6", 6, instance.sumRange(1, 3));
    39         assertEquals("sum(1,10)=55", 55, instance.sumRange(1, 10));
    40         assertEquals("sum(1,1)=1", 1, instance.sumRange(1, 1));
    41         assertEquals("sum(10,1)=55", 55, instance.sumRange(10, 1));
    42     }
    43     //END: design.composition.arith.test
    44 
    45 }