import static org.junit.Assert.*; import org.junit.After; import org.junit.Before; import org.junit.Test; /** * The test class ShortCalculatorTest. * * @author (your name) * @version (a version number or a date) */ public class ShortCalculatorTest { ShortCalculator shortCalculator; /** * Default constructor for test class ShortCalculatorTest */ public ShortCalculatorTest() { } /** * Sets up the test fixture. * * Called before every test case method. */ @Before public void setUp() { shortCalculator = new ShortCalculator(); } /** * Tears down the test fixture. * * Called after every test case method. */ @After public void tearDown() { } @Test public void sum(){//:Given short expected = 20; //:When short actual = shortCalculator.sum((short)10 , (short)10); //:Then assertEquals( expected, actual); } @Test public void subtract(){//:Given short expected = 20; //:When short actual = shortCalculator.subtract((short)35 , (short)15); //:Then assertEquals( expected, actual); } @Test public void divide(){//:Given short expected = 1; //:When short actual = shortCalculator.divide((short)10 , (short)10); //:Then assertEquals( expected, actual); } @Test public void multiply(){// short expected = 100; //:When short actual = shortCalculator.multiply((short)20 , (short)5); //:Then assertEquals(expected, actual); } @Test public void mod(){//:Given short expected = 0; //:When short actual = shortCalculator.mod((short)10 , (short)10); //:Then assertEquals( expected, actual); } }