@Test public void testMissingNullTermFunction() throws Exception { final Set<Violation> violations = new NulltermRules(toDocument("missing-nullterm-function.xml")) .doMeasuredAnalysis(); assertThat(violations).hasSize(1); assertThat(violations).contains(new NulltermViolation(15)); }
@Override protected Set<Violation> doMeasuredAnalysis() throws JDOMException { final Set<Violation> violations = new HashSet<Violation>(); for (final Element uarFunction : selectNodesByName("CALL.", "[NAME[1]/@text = 'UAR_SRVSETSTRING']")) { if (uarFunction.getChildren().size() > 3) { final Element Param3 = uarFunction.getChildren().get(3); if (!Param3.getName().equalsIgnoreCase("CALL.") && !getCclName(Param3).equalsIgnoreCase("NULLTERM")) { violations.add(new NulltermViolation(getLineNumber(Param3))); } } else { violations.add(new NulltermViolation(getLineNumber(uarFunction))); } } return violations; }
NulltermRules extends TimedDelegate { @Override protected Set<Violation> doMeasuredAnalysis() throws JDOMException { final Set<Violation> violations = new HashSet<Violation>(); for (final Element uarFunction : selectNodesByName("CALL.", "[NAME[1]/@text = 'UAR_SRVSETSTRING']")) { if (uarFunction.getChildren().size() > 3) { final Element Param3 = uarFunction.getChildren().get(3); if (!Param3.getName().equalsIgnoreCase("CALL.") && !getCclName(Param3).equalsIgnoreCase("NULLTERM")) { violations.add(new NulltermViolation(getLineNumber(Param3))); } } else { violations.add(new NulltermViolation(getLineNumber(uarFunction))); } } return violations; } }
NulltermRules extends TimedDelegate { @Override protected Set<Violation> doMeasuredAnalysis() throws JDOMException { final Set<Violation> violations = new HashSet<Violation>(); for (final Element uarFunction : selectNodesByName("CALL.", "[NAME[1]/@text = 'UAR_SRVSETSTRING']")) { if (uarFunction.getChildren().size() > 3) { final Element Param3 = uarFunction.getChildren().get(3); if (!Param3.getName().equalsIgnoreCase("CALL.") && !getCclName(Param3).equalsIgnoreCase("NULLTERM")) { violations.add(new NulltermViolation(getLineNumber(Param3))); } } else { violations.add(new NulltermViolation(getLineNumber(uarFunction))); } } return violations; } NulltermRules(final Document document); }
NulltermRules extends TimedDelegate { @Override protected Set<Violation> doMeasuredAnalysis() throws JDOMException { final Set<Violation> violations = new HashSet<Violation>(); for (final Element uarFunction : selectNodesByName("CALL.", "[NAME[1]/@text = 'UAR_SRVSETSTRING']")) { if (uarFunction.getChildren().size() > 3) { final Element Param3 = uarFunction.getChildren().get(3); if (!Param3.getName().equalsIgnoreCase("CALL.") && !getCclName(Param3).equalsIgnoreCase("NULLTERM")) { violations.add(new NulltermViolation(getLineNumber(Param3))); } } else { violations.add(new NulltermViolation(getLineNumber(uarFunction))); } } return violations; } NulltermRules(final Document document); @Override Set<Violation> getCheckedViolations(); }
NulltermRules extends TimedDelegate { @Override protected Set<Violation> doMeasuredAnalysis() throws JDOMException { final Set<Violation> violations = new HashSet<Violation>(); for (final Element uarFunction : selectNodesByName("CALL.", "[NAME[1]/@text = 'UAR_SRVSETSTRING']")) { if (uarFunction.getChildren().size() > 3) { final Element Param3 = uarFunction.getChildren().get(3); if (!Param3.getName().equalsIgnoreCase("CALL.") && !getCclName(Param3).equalsIgnoreCase("NULLTERM")) { violations.add(new NulltermViolation(getLineNumber(Param3))); } } else { violations.add(new NulltermViolation(getLineNumber(uarFunction))); } } return violations; } NulltermRules(final Document document); @Override Set<Violation> getCheckedViolations();  }