### Question:
SignedMacroBlockReferenceResolver implements BlockReferenceResolver<Block> { @Override public BlockReference resolve(Block block, Object... parameters) { EntityReference parent = null; if (parameters.length > 0 && parameters[0] instanceof EntityReference) { parent = (EntityReference) parameters[0]; } Digest digest = digestFactory.getInstance(); try { dumper.dump(digest.getOutputStream(), block); return new BlockReference(new EntityReference(encoder.encode(digest.digest()), EntityType.BLOCK, parent)); } catch (IOException ignore) { } return null; }  @Override BlockReference resolve(Block block, Object... parameters);  }### Answer:
@Test public void testResolveWithParent() throws Exception { DocumentReference parent = new DocumentReference("wiki","space","name"); assertThat(mocker.getComponentUnderTest().resolve(BLOCK, parent), equalTo(new BlockReference(ENCODED, parent))); verify(dumper).dump(stream, BLOCK); }
@Test public void testResolveWithNullParent() throws Exception { assertThat(mocker.getComponentUnderTest().resolve(BLOCK, new Object[] { null }), equalTo(new BlockReference(ENCODED))); verify(dumper).dump(stream, BLOCK); }
@Test public void testResolveWithoutParent() throws Exception { assertThat(mocker.getComponentUnderTest().resolve(BLOCK), equalTo(new BlockReference(ENCODED))); verify(dumper).dump(stream, BLOCK); }