@Test public void testDumpMacroMarkerBlockWithoutSource() throws Exception { byte[] dump1 = dumper.dump(new MacroBlock("macro", params, "content", false)); byte[] dump2 = dumper.dump(new MacroMarkerBlock("macro", params, "content", Collections.<Block>emptyList(), false)); assertThat(dump1, equalTo(dump2)); params.put("param", "value"); params.put("param2", "value2"); dump1 = dumper.dump(new MacroBlock("macro", params, "content", false)); dump2 = dumper.dump(new MacroMarkerBlock("macro", params, "content", Collections.<Block>emptyList(), false)); assertThat(dump1, equalTo(dump2)); }
@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);  }