Skip to content
This repository has been archived by the owner on Apr 13, 2019. It is now read-only.

Commit

Permalink
Increasing test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
rottebds committed Jul 26, 2017
1 parent fef6ef0 commit 768ab3e
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -214,4 +214,24 @@ public void validatePhoneHomeRequestBuilding() throws Exception{
assertTrue(phoneHomeRequestBuilder.md5Hash(phoneHomeRequestBuilder.getHostName()).equals(phoneHomeRequestWithHost.getRegId()));
}

@Test
public void validateBadPhoneHomeBackend() throws Exception{
final PhoneHomeClient phClient = new PhoneHomeClient(null, null, null);
try{
phClient.postPhoneHomeRequest(null);
fail("Phone home exception not thrown");
}catch(final PhoneHomeException e){
//Do nothing
}
}

@Test
public void constructPhoneHomeClientWithoutUrl() throws Exception{
final String targetUrl = "http://example.com:"+this.port+"/test";
final URL url = new URL(targetUrl);
final RestConnection restConnection = new UnauthenticatedRestConnection(new IntBufferedLogger(), url, TIMEOUT);
new PhoneHomeClient(new IntBufferedLogger(), restConnection);
//Cannot test this meaningfully without phoning home to an actual server, which is bad.
}

}

0 comments on commit 768ab3e

Please sign in to comment.