Created
November 5, 2010 22:24
-
-
Save marcphilipp/664977 to your computer and use it in GitHub Desktop.
Simple JUnit theory using junit-quickcheck
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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