@Test
public void testBasics() {

    List<Object> all = Arrays.asList("a", "b", "c", "d", "e", "f", "g", "h");
    for (int i = 0; i < 100; ++i) {
        Random r = new Random(SEED + i);
        Collection<Object> truthy = all.stream()
                .filter(x -> r.nextBoolean())
                .collect(Collectors.toSet());
        Theory<Object, Void> theory = positive -> {
            Collection<Object> bad = positive.stream()
                    .filter(x -> !truthy.contains(x))
                    .collect(Collectors.toSet());
            if (bad.size() > 0) {
                // Construct a random, nonempty unsat core.
                Collection<Object> unsat = new HashSet<>();
                unsat.add(bad.iterator().next());
                bad.stream().filter(x -> r.nextBoolean()).forEach(unsat::add);
                return Either.right(unsat);
            } else {
                return Either.left(null);
            }
        };
        Pair<Void, Collection<Object>> result = TheorySolver.solve(
            theory, new SatFixingSetFinder<>(new Sat4J()),
            Collections.emptyList(), all);
        Assert.assertEquals(all.size() - truthy.size(), result.getRight().size());
        Assert.assertEquals(truthy, all.stream().filter(x -> !result.getRight().contains(x)).collect(Collectors.toSet()));
    }
}