Advertisement
ivana_andreevska

Junit Test 2

May 18th, 2022
630
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import org.junit.jupiter.api.Test;
  2.  
  3. import static org.junit.jupiter.api.Assertions.*;
  4.  
  5. class CalculatorTest {
  6.     private final Calculator calculator=new Calculator();
  7.  
  8.     @Test
  9.     void divideNormalNumbers() {
  10.         System.out.println("Test divide normal number");
  11.         assertEquals(3,calculator.divide(9,3));
  12.         assertEquals(2,calculator.divide(4,2));
  13.         assertEquals(0,0,2);
  14.     }
  15.     @Test
  16.     void divideDecimalNumbers()
  17.     {
  18.         System.out.println("Divide decimal numbers");
  19.         assertEquals(2.25,calculator.divide(9,4));
  20.         assertEquals(0,calculator.divide(0,4.5));
  21.         assertEquals(0.5,calculator.divide(1,2));
  22.     }
  23. }
Advertisement
RAW Paste Data Copied
Advertisement