@Test public void containsErrorWhenNoError() throws Exception { MacroErrorManager errorManager = new MacroErrorManager(this.componentManager.getInstance(ErrorBlockGenerator.class)); XDOM xdom = new XDOM(Arrays.asList(new ParagraphBlock(Arrays.asList(new WordBlock("test"))))); Assert.assertFalse(errorManager.containsError(xdom)); }
public boolean containsError(XDOM xdom) { boolean foundError = false; List<Block> groupAndFormatBlocks = xdom.getBlocks( new OrBlockMatcher( new ClassBlockMatcher(GroupBlock.class), new ClassBlockMatcher(FormatBlock.class)), Block.Axes.DESCENDANT); for (Block block : groupAndFormatBlocks) { String classParameter = block.getParameters().get(ErrorBlockGenerator.CLASS_ATTRIBUTE_NAME); if (classParameter != null && classParameter.contains(ErrorBlockGenerator.CLASS_ATTRIBUTE_MESSAGE_VALUE)) { foundError = true; break; } } return foundError; }
MacroErrorManager { public boolean containsError(XDOM xdom) { boolean foundError = false; List<Block> groupAndFormatBlocks = xdom.getBlocks( new OrBlockMatcher( new ClassBlockMatcher(GroupBlock.class), new ClassBlockMatcher(FormatBlock.class)), Block.Axes.DESCENDANT); for (Block block : groupAndFormatBlocks) { String classParameter = block.getParameters().get(ErrorBlockGenerator.CLASS_ATTRIBUTE_NAME); if (classParameter != null && classParameter.contains(ErrorBlockGenerator.CLASS_ATTRIBUTE_MESSAGE_VALUE)) { foundError = true; break; } } return foundError; } }
MacroErrorManager { public boolean containsError(XDOM xdom) { boolean foundError = false; List<Block> groupAndFormatBlocks = xdom.getBlocks( new OrBlockMatcher( new ClassBlockMatcher(GroupBlock.class), new ClassBlockMatcher(FormatBlock.class)), Block.Axes.DESCENDANT); for (Block block : groupAndFormatBlocks) { String classParameter = block.getParameters().get(ErrorBlockGenerator.CLASS_ATTRIBUTE_NAME); if (classParameter != null && classParameter.contains(ErrorBlockGenerator.CLASS_ATTRIBUTE_MESSAGE_VALUE)) { foundError = true; break; } } return foundError; } MacroErrorManager(ErrorBlockGenerator errorBlockGenerator); }
MacroErrorManager { public boolean containsError(XDOM xdom) { boolean foundError = false; List<Block> groupAndFormatBlocks = xdom.getBlocks( new OrBlockMatcher( new ClassBlockMatcher(GroupBlock.class), new ClassBlockMatcher(FormatBlock.class)), Block.Axes.DESCENDANT); for (Block block : groupAndFormatBlocks) { String classParameter = block.getParameters().get(ErrorBlockGenerator.CLASS_ATTRIBUTE_NAME); if (classParameter != null && classParameter.contains(ErrorBlockGenerator.CLASS_ATTRIBUTE_MESSAGE_VALUE)) { foundError = true; break; } } return foundError; } MacroErrorManager(ErrorBlockGenerator errorBlockGenerator); void generateError(MacroBlock macroToReplace, String message, String description); void generateError(MacroBlock macroToReplace, String message, Throwable throwable); boolean containsError(XDOM xdom); }
MacroErrorManager { public boolean containsError(XDOM xdom) { boolean foundError = false; List<Block> groupAndFormatBlocks = xdom.getBlocks( new OrBlockMatcher( new ClassBlockMatcher(GroupBlock.class), new ClassBlockMatcher(FormatBlock.class)), Block.Axes.DESCENDANT); for (Block block : groupAndFormatBlocks) { String classParameter = block.getParameters().get(ErrorBlockGenerator.CLASS_ATTRIBUTE_NAME); if (classParameter != null && classParameter.contains(ErrorBlockGenerator.CLASS_ATTRIBUTE_MESSAGE_VALUE)) { foundError = true; break; } } return foundError; } MacroErrorManager(ErrorBlockGenerator errorBlockGenerator); void generateError(MacroBlock macroToReplace, String message, String description); void generateError(MacroBlock macroToReplace, String message, Throwable throwable); boolean containsError(XDOM xdom);  }