Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package arithmethique;
- import static org.testng.Assert.*;
- import org.testng.annotations.AfterClass;
- import org.testng.annotations.AfterMethod;
- import org.testng.annotations.BeforeClass;
- import org.testng.annotations.BeforeMethod;
- import org.testng.annotations.Test;
- /**
- *
- * @author guill
- */
- public class CalculatorNGTest {
- public CalculatorNGTest() {
- }
- @BeforeClass
- public static void setUpClass() throws Exception {
- }
- @AfterClass
- public static void tearDownClass() throws Exception {
- }
- @BeforeMethod
- public void setUpMethod() throws Exception {
- }
- @AfterMethod
- public void tearDownMethod() throws Exception {
- }
- /**
- * Test of add method, of class Calculator.
- */
- @Test
- public void testAdd() {
- System.out.println("add");
- int number1 = 4;
- int number2 = 2;
- int expResult = 6;
- int result = Calculator.add(number1, number2);
- assertEquals(Calculator.add(number1, number2), expResult, "test add()");
- }
- /**
- * Test of divInt method, of class Calculator.
- */
- @Test
- public void testDivInt() {
- System.out.println("divInt");
- int number1 = 4;
- int number2 = 2;
- int expResult = 2;
- assertEquals(Calculator.divInt(number1, number2), expResult, "test divInt()");
- }
- /**
- * Test of divReal method, of class Calculator.
- */
- @Test
- public void testDivReal() {
- System.out.println("divReal");
- int number1 = 6;
- int number2 = 3;
- double expResult = 2.0;
- assertEquals(Calculator.divReal(number1, number2), expResult, 0.0, "test divReal()");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement