### Question:
DiagnosticConstraintChecker extends ModelBasedConstraintChecker { DiagnosticConstraintChecker(TestModel testModel, TupleList diagnosedTupleList, Collection<Constraint> hardConstraints, Collection<Constraint> softConstraints, Object2IntMap<IntArrayWrapper> thresholds) { super(createModel(testModel, diagnosedTupleList, hardConstraints, softConstraints, thresholds)); Preconditions.notNull(thresholds); Preconditions.check(!thresholds.isEmpty()); } DiagnosticConstraintChecker(TestModel testModel,
                                TupleList diagnosedTupleList,
                                Collection<Constraint> hardConstraints,
                                Collection<Constraint> softConstraints,
                                Object2IntMap<IntArrayWrapper> thresholds);   }### Answer:
@Test void testDiagnosticConstraintChecker() { final TestModel MODEL = new TestModel(2, new int[]{2, 2, 2}, Collections.emptyList(), Arrays.asList( new TupleList(1, new int[]{0, 1}, Arrays.asList(new int[]{1, 0}, new int[]{0, 1})), new TupleList(2, new int[]{0, 1}, Collections.singletonList(new int[]{0, 0})), new TupleList(3, new int[]{2}, Collections.singletonList(new int[]{1})))); final List<Constraint> hardConstraints = Arrays.asList( MODEL.getErrorConstraints().get(0), MODEL.getErrorConstraints().get(2)); final List<Constraint> softConstraints = Collections.singletonList( MODEL.getErrorConstraints().get(1)); final Object2IntMap<IntArrayWrapper> thresholds = new Object2IntArrayMap<>(); thresholds.put(wrap(new int[] {0, 0}), 1); thresholds.put(wrap(new int[] {1, 1}), 0); final ConstraintChecker checker = new DiagnosticConstraintChecker( MODEL, MODEL.getErrorTupleLists().get(0), hardConstraints, softConstraints, thresholds); assertTrue(checker.isDualValid(new int[]{0, 1}, new int[] {0, 0})); assertTrue(checker.isDualValid(new int[]{0, 1}, new int[] {1, 1})); assertFalse(checker.isDualValid(new int[]{0, 1}, new int[] {1, 0})); assertFalse(checker.isDualValid(new int[]{0, 1}, new int[] {0, 1})); }