### Question:
DiagnosticConstraintCheckerFactory implements ConstraintCheckerFactory { @Override public ConstraintChecker createConstraintCheckerWithNegation(TestModel testModel, TupleList toBeNegated) { Preconditions.notNull(testModel); Preconditions.check(checkValidIdentifier(testModel, toBeNegated.getId())); final InternalConflictDiagnosisManager diagnostician = new InternalConflictDiagnosisManager(); final List<InternalMissingInvalidTuple> missingInvalidTuples = diagnostician.diagnose(testModel, toBeNegated); if(missingInvalidTuples.isEmpty()) { return new HardConstraintCheckerFactory() .createConstraintCheckerWithNegation(testModel, toBeNegated); } else { final Pair<List<Constraint>, List<Constraint>> partitions = splitter .splitConstraints(testModel, toBeNegated, missingInvalidTuples); final List<Constraint> hardConstraints = partitions.getLeft(); final List<Constraint> softConstraints = partitions.getRight(); final Object2IntMap<IntArrayWrapper> thresholds = thresholdComputer .computeThresholds(toBeNegated, missingInvalidTuples); return new DiagnosticConstraintChecker(testModel, toBeNegated, hardConstraints, softConstraints, thresholds); } } DiagnosticConstraintCheckerFactory();  DiagnosticConstraintCheckerFactory(DiagnosticConstraintSplitter splitter,
                                              DiagnosticConstraintThresholdComputer thresholdComputer); @Override ConstraintChecker createConstraintChecker(TestModel testModel); @Override ConstraintChecker createConstraintCheckerWithNegation(TestModel testModel, TupleList toBeNegated);  }### Answer:
@Test void testCreateConstraintCheckerWithNegationWithoutConflict() { final DiagnosticConstraintCheckerFactory factory = new DiagnosticConstraintCheckerFactory(); final ConstraintChecker checker = factory.createConstraintCheckerWithNegation(MODEL, MODEL.getErrorTupleLists().get(2)); assertTrue(checker instanceof HardConstraintChecker); }
@Test void testCreateConstraintCheckerWithNegationWithConflict() { final DiagnosticConstraintCheckerFactory factory = new DiagnosticConstraintCheckerFactory(); final ConstraintChecker checker = factory.createConstraintCheckerWithNegation(MODEL, MODEL.getErrorTupleLists().get(3)); assertFalse(checker.isDualValid(new int[]{0, 1}, new int[]{0, 0})); assertFalse(checker.isDualValid(new int[]{0, 2}, new int[]{0, 2})); assertTrue(checker.isDualValid(new int[]{0, 1}, new int[]{0, 1})); assertTrue(checker.isDualValid(new int[]{0, 1}, new int[]{0, 2})); }