### Question:
ConstraintConverter { public List<Constraint> convertAll(final Collection<TupleList> tupleLists) { final List<Constraint> constraints = new ArrayList<>(tupleLists.size()); for (TupleList forbiddenTuples : tupleLists) { final List<Constraint> constraint = convert(forbiddenTuples); constraints.addAll(constraint); } return constraints; }  List<Constraint> convertAll(final Collection<TupleList> tupleLists); List<Constraint> convert(TupleList tupleList);  }### Answer:
@Test void testUnsatisfiable() { List<TupleList> forbiddenTupleLists = Collections.singletonList(new TupleList(1, new int[]{0, 1}, Collections.singletonList(new int[]{0, 0}))); TestModel ipm = new TestModel(1, new int[]{2, 2, 2}, forbiddenTupleLists, Collections.emptyList()); Constraint internalConstraint = new ConstraintConverter().convertAll(ipm.getForbiddenTupleLists()).get(0); Model model = new Model(); IntVar var0 = model.intVar("0", 0, 1); IntVar var1 = model.intVar("1", 0, 1); internalConstraint.apply(model).post(); model.arithm(var0, "=", 0).post(); model.arithm(var1, "=", 0).post(); assertFalse(model.getSolver().solve()); }
@Test void testSatisfiable() { List<TupleList> forbiddenTupleLists = Collections.singletonList(new TupleList(1, new int[]{0, 1}, Collections.singletonList(new int[]{0, 0}))); TestModel ipm = new TestModel(1, new int[]{2, 2, 2}, forbiddenTupleLists, Collections.emptyList()); Constraint internalConstraint = new ConstraintConverter() .convertAll(ipm.getForbiddenTupleLists()).get(0); Model model = new Model(); IntVar var0 = model.intVar("0", 0, 1); IntVar var1 = model.intVar("1", 0, 1); internalConstraint.apply(model).post(); model.arithm(var0, "=", 1).post(); model.arithm(var1, "=", 1).post(); assertTrue(model.getSolver().solve()); }