Skip to content

Commit

Permalink
Issue #147: Add tests for ConnectionManager.getHost(String host).
Browse files Browse the repository at this point in the history
  • Loading branch information
mk23 committed Jan 22, 2017
1 parent 2d13219 commit 9f29829
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeNotNull;
import static org.junit.Assume.assumeTrue;

public class ConnectionManagerTest {
private final String passwdFile = System.getProperty("com.sun.management.jmxremote.password.file");
Expand Down Expand Up @@ -104,6 +105,20 @@ public void checkValidHostInvalidAuth() throws Exception {
assumeNotNull(passwdFile);
manager.getHost(validHost, invalidAuth);
}
@Test
public void checkValidHostAnonymousAuthAllowed() throws Exception {
final ConnectionManager manager = new ConnectionManager(new AppConfig());

assumeTrue(passwdFile == null);
assertNotNull(manager.getHost(validHost));
}
@Test(expected=WebApplicationException.class)
public void checkValidHostAnonymousAuthDisallowed() throws Exception {
final ConnectionManager manager = new ConnectionManager(new AppConfig());

assumeNotNull(passwdFile);
manager.getHost(validHost);
}

/* Host tests */
@Test
Expand Down

0 comments on commit 9f29829

Please sign in to comment.