### Question:
ShortNameRenderer { public String expand( String shortName ) { String uri = lookupShortName( shortName ); return (uri == null) ? shortName : uri; } ShortNameRenderer( ShortnameService sns, Iterable<Binding<Resource>> bindings ); ShortnameService shortNameService(); ShortnameService shortNameService( boolean required ); boolean isDatatype( String type ); Resource asResource( RDFNode r ); Resource asResource( String s ); String expand( String shortName ); String shorten( String uri, boolean memoise ); String shorten( String uri ); boolean hasShortNameService(); boolean isKnownShortnamePath( String path );  }### Answer:
@Test public void testExpandInEmptyMap() { final ShortNameRenderer snr = new ShortNameRenderer( null, null ); assertEquals( "foo", snr.expand( "foo" ) ); }
@Test public void testExpandWithBindings() { List<Binding<Resource>> bindings = new ArrayList<Binding<Resource>>(); bindings.add( new Binding<Resource>( "foo1", ResourceFactory.createResource( "http: bindings.add( new Binding<Resource>( "foo2", ResourceFactory.createResource( "http: final ShortNameRenderer snr = new ShortNameRenderer( null, bindings ); assertEquals( "http: assertEquals( "http: assertEquals( "foo3", snr.expand( "foo3" ) ); }
@Test public void testExpandWithService() { ShortnameService sns = stubShortNameService(); ShortNameRenderer snr = new ShortNameRenderer( sns, null ); assertEquals( "http: }