Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Reimplementation of the Math class to be used as an example for Unit Testing.
public final class Math {
public static int add(int first, int second) {
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;

This comment has been minimized.

Copy link

commented Jun 18, 2019


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.