Skip to content

Instantly share code, notes, and snippets.

@eranharel
Created May 25, 2011 07:14
Show Gist options
  • Save eranharel/990496 to your computer and use it in GitHub Desktop.
Save eranharel/990496 to your computer and use it in GitHub Desktop.
Calculator class for unit test tutorial
public class Calculator {
public int add(final int x, final int y) {
if (x < 0 || y < 0) {
throw new IllegalArgumentException("arguments must be positive");
}
return x + y;
}
public int substract(final int x, final int y) {
return x - y;
}
public int multiply(final int x, final int y) {
return x * y;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment