### Question:
DiscoveryService { @GET @Produces( MediaType.APPLICATION_JSON ) public Response getDiscoveryDocument( @Context UriInfo uriInfo ) { return outputFormat.ok( new DiscoveryRepresentation( new DiscoverableURIs.Builder( uris ).overrideAbsolutesFromRequest( uriInfo.getBaseUri() ).build() ) ); } DiscoveryService( @Context Config config, @Context OutputFormat outputFormat, @Context DiscoverableURIs uris ); @GET @Produces( MediaType.APPLICATION_JSON ) Response getDiscoveryDocument( @Context UriInfo uriInfo ); @GET @Produces( MediaType.WILDCARD ) Response redirectToBrowser();  }### Answer:
@Test public void shouldReturnValidJSON() throws Exception { Response response = testDiscoveryService().getDiscoveryDocument( uriInfo( baseUri ) ); String json = new String( (byte[]) response.getEntity() ); assertNotNull( json ); assertThat( json.length(), is( greaterThan( 0 ) ) ); assertThat( json, is( not( "\"\"" ) ) ); assertThat( json, is( not( "null" ) ) ); }
@Test public void shouldReturnBoltURI() throws Exception { Response response = testDiscoveryService().getDiscoveryDocument( uriInfo( baseUri ) ); String json = new String( (byte[]) response.getEntity() ); assertThat( json, containsString( "\"bolt\" : \"" + expectedBoltUri ) ); }
@Test public void shouldReturnDataURI() throws Exception { Response response = testDiscoveryService().getDiscoveryDocument( uriInfo( baseUri ) ); String json = new String( (byte[]) response.getEntity() ); assertThat( json, containsString( "\"data\" : \"" + expectedDataUri + "/\"" ) ); }
@Test public void shouldReturnManagementURI() throws Exception { Response response = testDiscoveryService().getDiscoveryDocument( uriInfo( baseUri ) ); String json = new String( (byte[]) response.getEntity() ); assertThat( json, containsString( "\"management\" : \"" + expectedManagementUri + "/\"" ) ); }