1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- import org.junit.Assert;
- import org.junit.After;
- import org.junit.Before;
- import org.junit.Test;
-
- public class ShortCalculatorTest {
- private ShortCalculator shortcalc;
-
- @Before
- public void setUp(){
- shortcalc = new ShortCalculator();
- }
-
- @Test
- public void addTest(){
- //:Given
- short expected = 300;
-
- //:When
- short actual = shortcalc.add((short)100,(short)200);
-
- //:Then
- Assert.assertEquals("Values should be equal", expected, actual);
- }
-
- @Test
- public void addBigNumberTest(){
- //:Given
- short expected = (short)110000;
-
- //:When
- short actual = shortcalc.add((short)50000,(short)60000);
-
- //:Then
- Assert.assertEquals("Values should be equal", expected, actual);
- }
-
- @Test
- public void subtractTest(){
- //:Given
- short expected = 1000;
-
- //:When
- short actual = shortcalc.subtract((short)2000,(short)1000);
-
- //:Then
- Assert.assertEquals("Values should be equal", expected, actual);
- }
-
- @Test
- public void multiplyTest(){
- //:Given
- short expected = 363;
-
- //:When
- short actual = shortcalc.multiply((short)33,(short)11);
-
- //:Then
- Assert.assertEquals("Values should be equal", expected, actual);
- }
-
- @Test
- public void divideTest(){
- //:Given
- short expected = 8;
-
- //:When
- short actual = shortcalc.divide((short)88,(short)11);
-
- //:Then
- Assert.assertEquals("Values should be equal", expected, actual);
- }
-
- @Test
- public void remainderTest(){
- //:Given
- short expected = 5;
-
- //:When
- short actual = shortcalc.remainder((short)105,(short)10);
-
- //:Then
- Assert.assertEquals("Values should be equal", expected, actual);
- }
- }
|