Advertisement
keymasterviriya1150

Junittest

Sep 27th, 2016
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.23 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6.  
  7. import mytest.Calculator;
  8. import org.junit.Before;
  9. import org.junit.Test;
  10. import static org.junit.Assert.*;
  11.  
  12. /**
  13.  *
  14.  * @author STD
  15.  */
  16. public class CalculatorTest {
  17.    
  18.     @Test
  19.     public void testmultiply() {
  20.         Calculator calculator = new Calculator();
  21.         int result = calculator.multiply(10, 50);
  22.         assertEquals(60, result);
  23.  
  24.     }
  25.  
  26.     @Test
  27.     public void testminus() {
  28.         Calculator calculator = new Calculator();
  29.         int result = calculator.minus(10, 50);
  30.         assertEquals(-40, result);
  31.         //assertEquals("Error!!!", 70, result);
  32.     }
  33.     @Test
  34.      public void testdivide() {
  35.      Calculator calculator = new Calculator();
  36.      int result = calculator.divide(10, 50);
  37.      assertEquals(0, result);
  38.      //assertEquals("Error!!!", 70, result);
  39.      }
  40.      @Test
  41.      public void testmodulo() {
  42.      Calculator calculator = new Calculator();
  43.      int result = calculator.modulo(10, 50);
  44.      assertEquals("fuck",10, result);
  45.      //assertEquals("Error!!!", 10, result);
  46.      }
  47.  
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement