@Test public void testIllegalArgumentException() throws Exception { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Unsupported block [org.xwiki.rendering.block.WordBlock]."); dumper.dump(new WordBlock("macro")); }
@Override public void dump(OutputStream out, Block block) throws IOException { if (block instanceof MacroBlock) { MacroBlock b = (MacroBlock) block; dump(out, b.getId(), b.getParameters(), b.getContent()); } else if (block instanceof MacroMarkerBlock) { MacroMarkerBlock b = (MacroMarkerBlock) block; dump(out, b.getId(), b.getParameters(), b.getContent()); } else { throw new IllegalArgumentException("Unsupported block [" + block.getClass().getName() + "]."); } String source = getSourceReference(block); if (source != null) { out.write(toBytes(source)); } out.write(0x00); }
MacroBlockDumper implements BlockDumper { @Override public void dump(OutputStream out, Block block) throws IOException { if (block instanceof MacroBlock) { MacroBlock b = (MacroBlock) block; dump(out, b.getId(), b.getParameters(), b.getContent()); } else if (block instanceof MacroMarkerBlock) { MacroMarkerBlock b = (MacroMarkerBlock) block; dump(out, b.getId(), b.getParameters(), b.getContent()); } else { throw new IllegalArgumentException("Unsupported block [" + block.getClass().getName() + "]."); } String source = getSourceReference(block); if (source != null) { out.write(toBytes(source)); } out.write(0x00); } }
MacroBlockDumper implements BlockDumper { @Override public void dump(OutputStream out, Block block) throws IOException { if (block instanceof MacroBlock) { MacroBlock b = (MacroBlock) block; dump(out, b.getId(), b.getParameters(), b.getContent()); } else if (block instanceof MacroMarkerBlock) { MacroMarkerBlock b = (MacroMarkerBlock) block; dump(out, b.getId(), b.getParameters(), b.getContent()); } else { throw new IllegalArgumentException("Unsupported block [" + block.getClass().getName() + "]."); } String source = getSourceReference(block); if (source != null) { out.write(toBytes(source)); } out.write(0x00); }  }
MacroBlockDumper implements BlockDumper { @Override public void dump(OutputStream out, Block block) throws IOException { if (block instanceof MacroBlock) { MacroBlock b = (MacroBlock) block; dump(out, b.getId(), b.getParameters(), b.getContent()); } else if (block instanceof MacroMarkerBlock) { MacroMarkerBlock b = (MacroMarkerBlock) block; dump(out, b.getId(), b.getParameters(), b.getContent()); } else { throw new IllegalArgumentException("Unsupported block [" + block.getClass().getName() + "]."); } String source = getSourceReference(block); if (source != null) { out.write(toBytes(source)); } out.write(0x00); }  @Override void dump(OutputStream out, Block block); @Override byte[] dump(Block block); }
MacroBlockDumper implements BlockDumper { @Override public void dump(OutputStream out, Block block) throws IOException { if (block instanceof MacroBlock) { MacroBlock b = (MacroBlock) block; dump(out, b.getId(), b.getParameters(), b.getContent()); } else if (block instanceof MacroMarkerBlock) { MacroMarkerBlock b = (MacroMarkerBlock) block; dump(out, b.getId(), b.getParameters(), b.getContent()); } else { throw new IllegalArgumentException("Unsupported block [" + block.getClass().getName() + "]."); } String source = getSourceReference(block); if (source != null) { out.write(toBytes(source)); } out.write(0x00); }  @Override void dump(OutputStream out, Block block); @Override byte[] dump(Block block);  }