package au.id.zancanaro.javacheck; import au.id.zancanaro.javacheck.annotations.Property; import au.id.zancanaro.javacheck.junit.Properties; import org.junit.runner.RunWith; import java.util.ArrayList; import java.util.List; import static java.util.Collections.reverse; import static java.util.Collections.sort; import static org.junit.Assert.assertEquals; @RunWith(Properties.class) public class SimpleListOperationsTest { @Property public void sortingIsIdempotent(List list) { List left = new ArrayList<>(list); sort(left); List right = new ArrayList<>(list); sort(right); sort(right); assertEquals(left, right); } @Property public void reverseIsInvolution(List list) { List newList = new ArrayList<>(list); reverse(newList); reverse(newList); assertEquals(list, newList); } }