Skip to content

Instantly share code, notes, and snippets.

@marcphilipp
Created November 5, 2010 22:24
Show Gist options
  • Save marcphilipp/664977 to your computer and use it in GitHub Desktop.
Save marcphilipp/664977 to your computer and use it in GitHub Desktop.
Simple JUnit theory using junit-quickcheck
package de.xpdays.junit;
import static org.junit.Assert.assertEquals;
import static org.junit.Assume.assumeTrue;
import org.junit.experimental.theories.Theories;
import org.junit.experimental.theories.Theory;
import org.junit.runner.RunWith;
import com.pholser.junit.parameters.ForAll;
@RunWith(Theories.class)
public class MathTheories {
@Theory
public void absoluteValueOfNegatives(@ForAll int n) {
System.out.println(n);
assumeTrue(n < 0);
assertEquals(-n, Math.abs(n));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment