@Test public void testCorrectnessOfMissingDispatchStack() { Processor p = new Processor(); p.setDispatchStack(null); CorrectnessValidator cv = new CorrectnessValidator(); ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener(); cv.checkCorrectness(p, false, rcvl); Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems(); assertEquals(Collections.EMPTY_SET, nullFieldProblems); // only done when completeness check }
@Test public void testCompletenessOfSpecifiedIterationStrategyStack() { Processor p = new Processor(); CorrectnessValidator cv = new CorrectnessValidator(); ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener(); cv.checkCorrectness(p, true, rcvl); Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems(); boolean problem = false; for (NullFieldProblem nlp : nullFieldProblems) { if (nlp.getBean().equals(p) && nlp.getFieldName().equals("iterationStrategyStack")) { problem = true; } } assertFalse(problem); }
@Test public void testCompletenessOfMissingDispatchStack() { Processor p = new Processor(); p.setDispatchStack(null); CorrectnessValidator cv = new CorrectnessValidator(); ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener(); cv.checkCorrectness(p, true, rcvl); Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems(); assertFalse(nullFieldProblems.isEmpty()); boolean problem = false; for (NullFieldProblem nlp : nullFieldProblems) { if (nlp.getBean().equals(p) && nlp.getFieldName().equals("dispatchStack")) { problem = true; } } assertTrue(problem); }