OperationsTest.java 723B

123456789101112131415161718192021222324252627282930
  1. import org.junit.Test;
  2. import org.junit.Assert;
  3. public class OperationsTest {
  4. @Test
  5. public void testAdd() throws Exception {
  6. Assert.assertEquals(2, Operations.add(1, 1));
  7. }
  8. @Test
  9. public void testSubtract() throws Exception {
  10. Assert.assertEquals(0, Operations.subtract(1, 1));
  11. }
  12. @Test
  13. public void testMultiply() throws Exception {
  14. Assert.assertEquals(4, Operations.multiply(2, 2));
  15. }
  16. @Test
  17. public void testDivide() throws Exception{
  18. Operations operations = new Operations();
  19. int x = 10;
  20. int y = 2;
  21. int expected = 5;
  22. int actual = operations.divide(x,y);
  23. Assert.assertEquals(expected, actual);
  24. }
  25. }