### Question:
ShortNameRenderer { public Resource asResource( RDFNode r ) { return shortNameService().asResource( r ); } 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 testAsResourceRDFNode() { final ShortnameService sns = context.mock( ShortnameService.class ); final ShortNameRenderer snr = new ShortNameRenderer( sns, null ); final RDFNode n = ResourceFactory.createResource( "http context.checking(new Expectations() {{ oneOf (sns).asResource( n ); }}); snr.asResource( n ); }
@Test public void testAsResourceString() { final ShortnameService sns = context.mock( ShortnameService.class ); final ShortNameRenderer snr = new ShortNameRenderer( sns, null ); context.checking(new Expectations() {{ oneOf (sns).asResource( "foo" ); }}); snr.asResource( "foo" ); }