### Question:
SoftConstraintCheckerFactory implements ConstraintCheckerFactory { @Override public ConstraintChecker createConstraintCheckerWithNegation(TestModel testModel, TupleList toBeNegated) { Preconditions.notNull(testModel); Preconditions.check(checkValidIdentifier(testModel, toBeNegated.getId())); final int threshold = computeThreshold(testModel, toBeNegated); if(threshold == 0) { return new HardConstraintCheckerFactory() .createConstraintCheckerWithNegation(testModel, toBeNegated); } else { final List<Constraint> hardConstraints = new ArrayList<>(); hardConstraints.add(negateConstraint(findErrorConstraintToBeNegated(testModel, toBeNegated))); final List<Constraint> softConstraints = filterErrorConstraintToBeNegated(testModel, toBeNegated); softConstraints.addAll(testModel.getExclusionConstraints()); return new SoftConstraintChecker(testModel, hardConstraints, softConstraints, threshold); } }  @Override ConstraintChecker createConstraintChecker(TestModel testModel); @Override ConstraintChecker createConstraintCheckerWithNegation(TestModel testModel, TupleList toBeNegated);  }### Answer:
@Test void testCreateConstraintCheckerWithNegationAndConflict() { final SoftConstraintCheckerFactory factory = new SoftConstraintCheckerFactory(); final ConstraintChecker checker = factory.createConstraintCheckerWithNegation(MODEL, MODEL.getErrorTupleLists().get(0)); final ConstraintChecker otherSolver = new SoftConstraintChecker(MODEL, MODEL.getExclusionConstraints(), errorConstraintsWithNegation(MODEL, MODEL.getErrorTupleLists().get(0)), 1); assertEquals(otherSolver.isValid(new int[]{1, 1, 0}), checker.isValid(new int[]{1, 1, 0})); assertEquals(otherSolver.isValid(new int[]{0, 0, 0}), checker.isValid(new int[]{0, 0, 0})); }
@Test void testCreateConstraintCheckerWithNegationAndNoConflict() { final SoftConstraintCheckerFactory factory = new SoftConstraintCheckerFactory(); final ConstraintChecker checker = factory.createConstraintCheckerWithNegation(MODEL, MODEL.getErrorTupleLists().get(2)); assertTrue(checker instanceof HardConstraintChecker); }