This library provides JUnit QuickCheck generators for Vavr.
- Option
- List
- Tuple0..8
- Map
Gradle
testCompile("com.sir4ur0n", "junit-quickcheck-vavr", "1.0")
Maven
<dependency>
<groupId>com.sir4ur0n</groupId>
<artifactId>junit-quickcheck-vavr</artifactId>
<version>1.0</version>
<scope>test</scope>
</dependency>
Now Vavr structures are supported inside all your JUnit QuickCheck tests:
import com.pholser.junit.quickcheck.Property;
import com.pholser.junit.quickcheck.runner.JUnitQuickcheck;
import io.vavr.Tuple3;
import io.vavr.collection.List;
import io.vavr.collection.Map;
import io.vavr.control.Option;
import org.junit.Before;
import org.junit.runner.RunWith;
@RunWith(JUnitQuickcheck.class)
public class MyBusinessClassTest {
private MyBusinessClass cut;
@Before
public void setUp() {
cut = new MyBusinessClass();
}
@Property
public void myBusinessTest(
Option<String> vavrOption,
List<String> vavrList,
Tuple3<String, Boolean, Integer> vavrTuple,
Map<Integer, String> vavrMap,
PojoWithVavrFields pojoWithVavrFields) {
// Your regular Property Based Test goes here
}
}
./gradlew build
./gradlew test
./gradlew publishToMavenLocal
You need to provide a gradle.properties
file with Bintray credentials, e.g.
bintrayRepo=sir4ur0n-repository
bintrayUser=sir4ur0n
bintrayKey=1234567890
Then:
./gradlew bintrayUpload
- In
Preferences / Build, Execution, Deployment / Compiler / Annotations Processors
, enableannotation processing
- Import:
File / New.. / Project from existing sources / Gradle / Gradle wrapper