### Question:
ReduceBasedDiagnosisHittingSetBuilder { MissingInvalidTuple extendWithDiagnosisSetsForNegatedErrorConstraint(MissingInvalidTuple mit) { final List<DiagnosisSet> diagnosisSetList = copyDiagnosisSets(mit.getExplanation()); if(!isMarkedAsCorrect(mit.getNegatedErrorConstraintId())) { diagnosisSetList.add(new DiagnosisSet(Collections.singletonList( new DiagnosisElement(mit.getNegatedErrorConstraintId(), mit.getInvolvedParameters(), mit.getMissingValues())) )); } final ConflictSet rootConflictSet = copyRootConflictSet(mit.getExplanation()); final DiagnosisSets diagnosisSets = new DiagnosisSets(rootConflictSet, diagnosisSetList); return new MissingInvalidTuple( mit.getNegatedErrorConstraintId(), mit.getInvolvedParameters(), mit.getMissingValues(), diagnosisSets); } ReduceBasedDiagnosisHittingSetBuilder(TestModel testModel); List<DiagnosisHittingSet> computeMinimalDiagnosisHittingSets(List<MissingInvalidTuple> mits);  }### Answer:
@Test void testExtendWithDiagnosisSetsForNegatedErrorConstraint() { final TestModel model = mock(TestModel.class); when(model.getForbiddenTupleLists()).thenReturn(emptyList()); when(model.getErrorTupleLists()).thenReturn(Arrays.asList( new TupleList(1, new int[]{ 1 }, singletonList(new int[]{ 1 })), new TupleList(2, new int[]{ 1 }, singletonList(new int[]{ 1 })), new TupleList(4, new int[]{ 1 }, singletonList(new int[]{ 1 })), new TupleList(5, new int[]{ 1 }, singletonList(new int[]{ 1 })) )); final ConflictSet conflictSet = mock(ConflictSet.class); final List<MissingInvalidTuple> mits = new ArrayList<>(); mits.add(new MissingInvalidTuple(2, new int[] {1}, new int[] {2}, new DiagnosisSets(conflictSet, asList( new DiagnosisSet(singletonList(new DiagnosisElement(1, new int[]{0}, new int[]{2}))), new DiagnosisSet(singletonList(new DiagnosisElement(4, new int[]{0, 1}, new int[]{0, 2}))), new DiagnosisSet(singletonList(new DiagnosisElement(5, new int[]{0, 1}, new int[]{1, 2}))))))); mits.add(new MissingInvalidTuple(4, new int[] {0, 1}, new int[] {0, 2}, new DiagnosisSets(conflictSet, singletonList( new DiagnosisSet(singletonList(new DiagnosisElement(2, new int[]{1}, new int[]{2}))))))); mits.add(new MissingInvalidTuple(5, new int[] {0, 1}, new int[] {1, 2}, new DiagnosisSets(conflictSet, singletonList( new DiagnosisSet(singletonList(new DiagnosisElement(2, new int[]{1}, new int[]{2}))))))); final ReduceBasedDiagnosisHittingSetBuilder builder = new ReduceBasedDiagnosisHittingSetBuilder(model); final MissingInvalidTuple extended = builder.extendWithDiagnosisSetsForNegatedErrorConstraint(mits.get(0)); assertTrue(((DiagnosisSets) extended.getExplanation()).getDiagnosisSets().stream() .anyMatch(diagnosisSet -> diagnosisSet.getDiagnosisElements().stream() .anyMatch(element -> element.getDiagnosedConstraintId() == mits.get(0).getNegatedErrorConstraintId())) ); }