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 { /** * Default constructor for test class ShortCalculatorTest */ ShortCalculator shortCalculator; public ShortCalculatorTest() { shortCalculator = new ShortCalculator(); } /** * 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 add(){ //:Given short expected = 4; //:When short actual = shortCalculator.add((short) 2,(short) 2); //:Then assertEquals( expected, actual); } @Test public void subtract(){ //Given short expected = 4; //When short actual = shortCalculator.subtract((short) 10, (short) 6); //Then assertEquals( expected, actual); } @Test public void multiply(){ //Given short expected = 40; //When short actual = shortCalculator.multiply((short) 10, (short) 4); //Then assertEquals( expected, actual); } @Test public void divide(){ //Given short expected = 10; //When short actual = shortCalculator.divide((short) 40, (short) 4); //Then assertEquals( expected, actual); } }