### Question:
MetadataLinkListener implements RenderingListener { public void setMetaDataRegistry( MetaDataRegistry metaDataRegistry ) { this._metaDataRegistry = metaDataRegistry; } MetadataLinkListener();  MetadataLinkListener( MetaDataRegistry metaDataRegistry ); void setMetaDataRegistry( MetaDataRegistry metaDataRegistry ); @Override void eventOccurred( RenderingEvent<T> event );  }### Answer:
@SuppressWarnings("unchecked") @Test public void testMetadataHref() { String prefixUrl = "/metadata/"; String fileExtension = "test"; Album signOfTheTimes = DataGenerator.signOfTheTimes(); DefaultMetaDataRegistry service = new DefaultMetaDataRegistry(); service.setRootMetaDataUrl( prefixUrl ); service.setCoreSelector( getCoreSelector() ); Map<String,Class<?>> typeMappings = new HashMap<String, Class<?>>(); typeMappings.put( "album", Album.class ); service.setTypeMappings( typeMappings ); MetadataLinkListener metadataLinkListener = new MetadataLinkListener(); metadataLinkListener.setMetaDataRegistry( service ); ResultTraverser traverser = new ResultTraverser(); Map<String, Object> objectTree = doTraverse( signOfTheTimes, "", traverser, metadataLinkListener ); Map<String,String> metadataMap = (Map<String,String>) objectTree.get( "metadata" ); String metadataHref = prefixUrl + "album." + fileExtension; Assert.assertEquals( metadataHref, metadataMap.get( "href" ) ); }