Discussion on: Introduction to Unit Testing with Java

chrisvasqm profile image
Christian Vasquez Author

Thanks for letting me know, Seth!

That's my fault.

Try removing this from the Math.java file:

private Math() {}

The entire class should be like this now:

public final class Math {

    public static int add(int firstNumber, int secondNumber) {
        return firstNumber + secondNumber;

    public static int multiply(int multiplicand, int multiplier) {
        return multiplicand * multiplier;

    public static double divide(int dividend, int divisor) {
        if (divisor == 0)
            throw new IllegalArgumentException("Cannot divide by zero (0).");

        return dividend / divisor;

In case you or someone else also wonders why, the private Math() {} refers to the constructor of our Math class, I made it private at the beginning because all it's methods are static, which prevents anyone from trying to instantiate it. But later on I decided to also add an example where we had the need to use an object and I forgot to update it hahaha.

itzsaga profile image

That works. Thanks!