### Question:
ShortNameRenderer { public ShortnameService shortNameService() { return shortNameService( true ); } 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 testGetShortNameService() { final ShortnameService sns = context.mock( ShortnameService.class ); final ShortNameRenderer snr = new ShortNameRenderer( sns, null ); assertSame( sns, snr.shortNameService() ); assertSame( sns, snr.shortNameService( true ) ); assertSame( sns, snr.shortNameService( false ) ); final ShortNameRenderer snrNoService = new ShortNameRenderer( null, null ); assertNull( snrNoService.shortNameService( false ) ); }
@Test(expected=EldaException.class) public void testGetShortNameServiceRaise() { final ShortNameRenderer snrNoService = new ShortNameRenderer( null, null ); snrNoService.shortNameService(); }