12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
-
-
- 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 shortVariableSumTest(){
- //:Given
- short expected = 30;
-
- //:When
- short actual = shortCalculator.sum((short)10,(short)20);
-
- //:Then
- Assert.assertEquals(expected, actual);
- }
- @Test
- public void shortVariablediffTest(){
- //:Given
- short expected = 10;
-
- //:When
- short actual = shortCalculator.diff((short)20,(short)10);
-
- //:Then
- Assert.assertEquals(expected, actual);
- }
- @Test
- public void shortVariableProdTest(){
- //:Given
- short expected = 200;
-
- //:When
- short actual = shortCalculator.prod((short)10,(short)20);
-
- //:Then
- Assert.assertEquals(expected, actual);
- }
- @Test
- public void shortVariableQuotTest(){
- //:Given
- short expected = 2;
-
- //:When
- short actual = shortCalculator.quot((short)20,(short)10);
-
- //:Then
- Assert.assertEquals(expected, actual);
- }
- @Test
- public void shortVariableRemainderTest(){
- //:Given
- short expected = 1;
-
- //:When
- short actual = shortCalculator.remain((short)10,(short)3);
-
- //:Then
- Assert.assertEquals(expected, actual);
- }
- }
-
|