@Test public void testIncompatibleBlockSignature() throws Exception { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Unsupported block [org.xwiki.rendering.block.WordBlock]."); assertThat(signer.generate(new WordBlock("macro"), CMS_PARAMS), equalTo(BLOCK_SIGNATURE)); }
@Override public byte[] generate(Block block, CMSSignedDataGeneratorParameters params) throws GeneralSecurityException, IOException { if (!isSupported(block)) { throw new IllegalArgumentException("Unsupported block [" + block.getClass().getName() + "]."); } return generator.generate(dumper.dump(block), params); }
MacroBlockSignatureGenerator implements BlockSignatureGenerator { @Override public byte[] generate(Block block, CMSSignedDataGeneratorParameters params) throws GeneralSecurityException, IOException { if (!isSupported(block)) { throw new IllegalArgumentException("Unsupported block [" + block.getClass().getName() + "]."); } return generator.generate(dumper.dump(block), params); } }
MacroBlockSignatureGenerator implements BlockSignatureGenerator { @Override public byte[] generate(Block block, CMSSignedDataGeneratorParameters params) throws GeneralSecurityException, IOException { if (!isSupported(block)) { throw new IllegalArgumentException("Unsupported block [" + block.getClass().getName() + "]."); } return generator.generate(dumper.dump(block), params); }  }
MacroBlockSignatureGenerator implements BlockSignatureGenerator { @Override public byte[] generate(Block block, CMSSignedDataGeneratorParameters params) throws GeneralSecurityException, IOException { if (!isSupported(block)) { throw new IllegalArgumentException("Unsupported block [" + block.getClass().getName() + "]."); } return generator.generate(dumper.dump(block), params); }  @Override byte[] generate(Block block, CMSSignedDataGeneratorParameters params); @Override boolean isSupported(Block block); }
MacroBlockSignatureGenerator implements BlockSignatureGenerator { @Override public byte[] generate(Block block, CMSSignedDataGeneratorParameters params) throws GeneralSecurityException, IOException { if (!isSupported(block)) { throw new IllegalArgumentException("Unsupported block [" + block.getClass().getName() + "]."); } return generator.generate(dumper.dump(block), params); }  @Override byte[] generate(Block block, CMSSignedDataGeneratorParameters params); @Override boolean isSupported(Block block);  }