12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- import static org.junit.Assert.*;
- import org.junit.After;
- import org.junit.Before;
- import org.junit.Test;
-
-
- public class ShortCalculatorTest {
- ShortCalculator test;
-
- public ShortCalculatorTest() {
- test = new ShortCalculator();
- }
-
- @Test
- public void testAdd(){
- //expected
- short expected = 10;
- //actual
- short actual =test.add((short)5,(short)5);
- //then
- assertEquals(expected, actual);
-
-
- }
-
- @Test
- public void testSubtract(){
- //expected
- short expected = 5;
- //actual
- short actual =test.subtract((short)10,(short)5);
- //then
- assertEquals(expected, actual);
-
-
- }
-
- @Test
- public void testMultiply(){
- //expected
- short expected = 25;
- //actual
- short actual =test.multiply((short)5,(short)5);
- //then
- assertEquals(expected, actual);
-
-
- }
-
- @Test
- public void testDivide(){
- //expected
- short expected = 5;
- //actual
- short actual =test.divide((short)10,(short)2);
- //then
- assertEquals(expected, actual);
-
-
- }
-
- @Test
- public void testRemainder(){
- //expected
- short expected = 1;
- //actual
- short actual =test.remainder((short)10,(short)3);
- //then
- assertEquals(expected, actual);
-
-
- }
-
-
- }
|