Advertisement
ivana_andreevska

Junit Test 1

May 18th, 2022
609
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class Calculator {
  2.     public double divide(double a , double b)
  3.     {
  4.         return a/b;
  5.     }
  6. }
  7. import org.junit.jupiter.api.Test;
  8.  
  9. import static org.junit.jupiter.api.Assertions.*;
  10.  
  11. class CalculatorTest {
  12.     private final Calculator calculator=new Calculator();
  13.  
  14.     @Test
  15.     void divide() {
  16.         assertEquals(3,calculator.divide(9,3));
  17.         assertEquals(2,calculator.divide(4,2));
  18.         assertEquals(3,calculator.divide(9,4));
  19.     }
  20. }
Advertisement
RAW Paste Data Copied
Advertisement