junit-quickcheck is a library that supports writing and running property-based tests in JUnit, inspired by QuickCheck for Haskell.
junit-quickcheck is source/target-compatible with JDK 8.
import com.pholser.junit.quickcheck.Property;
import com.pholser.junit.quickcheck.runner.JUnitQuickcheck;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
@RunWith(JUnitQuickcheck.class)
public class StringProperties {
@Property public void concatenationLength(String s1, String s2) {
assertEquals(s1.length() + s2.length(), (s1 + s2).length());
}
}