Advertisement
ryltar0

Untitled

Jul 18th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.91 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. package arithmethique;
  7.  
  8. import static org.testng.Assert.*;
  9. import org.testng.annotations.AfterClass;
  10. import org.testng.annotations.AfterMethod;
  11. import org.testng.annotations.BeforeClass;
  12. import org.testng.annotations.BeforeMethod;
  13. import org.testng.annotations.Test;
  14.  
  15. /**
  16.  *
  17.  * @author guill
  18.  */
  19. public class CalculatorNGTest {
  20.    
  21.     public CalculatorNGTest() {
  22.     }
  23.  
  24.     @BeforeClass
  25.     public static void setUpClass() throws Exception {
  26.     }
  27.  
  28.     @AfterClass
  29.     public static void tearDownClass() throws Exception {
  30.     }
  31.  
  32.     @BeforeMethod
  33.     public void setUpMethod() throws Exception {
  34.     }
  35.  
  36.     @AfterMethod
  37.     public void tearDownMethod() throws Exception {
  38.     }
  39.  
  40.     /**
  41.      * Test of add method, of class Calculator.
  42.      */
  43.     @Test
  44.     public void testAdd() {
  45.         System.out.println("add");
  46.         int number1 = 4;
  47.         int number2 = 2;
  48.         int expResult = 6;
  49.         int result = Calculator.add(number1, number2);
  50.         assertEquals(Calculator.add(number1, number2), expResult, "test add()");
  51.     }
  52.  
  53.     /**
  54.      * Test of divInt method, of class Calculator.
  55.      */
  56.     @Test
  57.     public void testDivInt() {
  58.         System.out.println("divInt");
  59.         int number1 = 4;
  60.         int number2 = 2;
  61.         int expResult = 2;
  62.         assertEquals(Calculator.divInt(number1, number2), expResult, "test divInt()");
  63.     }
  64.  
  65.     /**
  66.      * Test of divReal method, of class Calculator.
  67.      */
  68.     @Test
  69.     public void testDivReal() {
  70.         System.out.println("divReal");
  71.         int number1 = 6;
  72.         int number2 = 3;
  73.         double expResult = 2.0;
  74.         assertEquals(Calculator.divReal(number1, number2), expResult, 0.0, "test divReal()");
  75.     }
  76.    
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement