123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- import org.junit.Assert;
- import org.junit.Before;
- import org.junit.Test;
-
- public class ShortCalculatorTest
- {
- private ShortCalculator shortCalculator;
-
- @Before
- public void setUp(){
- shortCalculator = new ShortCalculator();
- }
-
- @Test
- public void sumTest(){
- // :Given
- short expected = 12;
-
- // :When
- short actual = shortCalculator.sum((short) 10, (short)2);
-
- // :Then
- Assert.assertEquals("The values equal 12", expected, actual);
- }
-
- @Test
- public void differenctTest(){
- // :Given
- short expected = 8;
- // :When
- short actual = shortCalculator.difference((short)10, (short)2);
- // :Then
- Assert.assertEquals("The values equal 8", expected, actual);
- }
-
- @Test
- public void productTest(){
- // :Given
- short expected = 20;
- // :When
- short actual = shortCalculator.product((short)10, (short)2);
- // :Then
- Assert.assertEquals("The values equal 20", expected, actual);
- }
-
- @Test
- public void quotientTest(){
- // :Given
- short expected = 10;
- // :When
- short actual = shortCalculator.quotient((short)20, (short)2);
- // :Then
- Assert.assertEquals("The values equal 10", expected, actual);
- }
-
- @Test
- public void remainderTest(){
- // :Given
- short expected = 1;
- // :When
- short actual = shortCalculator.remainder ((short)5, (short)2);
- // :Then
- Assert.assertEquals("The values equal 1", expected, actual);
- }
- }
|