Skip to content

Commit

Permalink
mockDiscoveryService->testDiscoveryService
Browse files Browse the repository at this point in the history
  • Loading branch information
technige committed Jun 27, 2016
1 parent 2c82adb commit 759dfa0
Showing 1 changed file with 5 additions and 5 deletions.
Expand Up @@ -68,7 +68,7 @@ private Config mockConfig() throws URISyntaxException
return mockConfig; return mockConfig;
} }


private DiscoveryService mockDiscoveryService() throws URISyntaxException private DiscoveryService testDiscoveryService() throws URISyntaxException
{ {
Config mockConfig = mockConfig(); Config mockConfig = mockConfig();
return new DiscoveryService( mockConfig, new EntityOutputFormat( new JsonFormat(), new URI( return new DiscoveryService( mockConfig, new EntityOutputFormat( new JsonFormat(), new URI(
Expand All @@ -78,7 +78,7 @@ private DiscoveryService mockDiscoveryService() throws URISyntaxException
@Test @Test
public void shouldReturnValidJSON() throws Exception public void shouldReturnValidJSON() throws Exception
{ {
Response response = mockDiscoveryService().getDiscoveryDocument(); Response response = testDiscoveryService().getDiscoveryDocument();
String json = new String( (byte[]) response.getEntity() ); String json = new String( (byte[]) response.getEntity() );


assertNotNull( json ); assertNotNull( json );
Expand All @@ -90,23 +90,23 @@ public void shouldReturnValidJSON() throws Exception
@Test @Test
public void shouldReturnBoltURI() throws Exception public void shouldReturnBoltURI() throws Exception
{ {
Response response = mockDiscoveryService().getDiscoveryDocument(); Response response = testDiscoveryService().getDiscoveryDocument();
String json = new String( (byte[]) response.getEntity() ); String json = new String( (byte[]) response.getEntity() );
assertThat( json, containsString( "\"bolt\" : \"bolt://" + boltAddress + "\"" ) ); assertThat( json, containsString( "\"bolt\" : \"bolt://" + boltAddress + "\"" ) );
} }


@Test @Test
public void shouldReturnDataURI() throws Exception public void shouldReturnDataURI() throws Exception
{ {
Response response = mockDiscoveryService().getDiscoveryDocument(); Response response = testDiscoveryService().getDiscoveryDocument();
String json = new String( (byte[]) response.getEntity() ); String json = new String( (byte[]) response.getEntity() );
assertThat( json, containsString( "\"data\" : \"" + baseUri + dataUri + "/\"" ) ); assertThat( json, containsString( "\"data\" : \"" + baseUri + dataUri + "/\"" ) );
} }


@Test @Test
public void shouldReturnManagementURI() throws Exception public void shouldReturnManagementURI() throws Exception
{ {
Response response = mockDiscoveryService().getDiscoveryDocument(); Response response = testDiscoveryService().getDiscoveryDocument();
String json = new String( (byte[]) response.getEntity() ); String json = new String( (byte[]) response.getEntity() );
assertThat( json, containsString( "\"management\" : \"" + baseUri + managementUri + "/\"" ) ); assertThat( json, containsString( "\"management\" : \"" + baseUri + managementUri + "/\"" ) );
} }
Expand Down

0 comments on commit 759dfa0

Please sign in to comment.