In this tutorial we will dive into JUnit5 framework even more basing on simple Calculator project that will grow with us during tutorial.
Project Structure:
. ├── pom.xml └── src ├── main │ └── java │ └── Calculator.java └── test └── java └── CalculatorTest.java
Our Calculator.java
look like this:
public class Calculator { static Double divide(Double a, Double b) { if (b != 0) { return a / b; } else{ throw new ArithmeticException("Division by 0 is impossible!"); } } public static void main(String[] args) { System.out.printf(Calculator.divide(8.0,2.0).toString()); } }