@Test public void testAuthentication() throws HttpAction { final IpClient client = new IpClient(new SimpleTestTokenAuthenticator()); final MockWebContext context = MockWebContext.create(); context.setRemoteAddress(IP); final TokenCredentials credentials = client.getCredentials(context); final CommonProfile profile = client.getUserProfile(credentials, context); assertEquals(IP, profile.getId()); }
@Test public void testHasDefaultProfileCreator() { final IpClient client = new IpClient(new SimpleTestTokenAuthenticator()); client.init(null); }
@Test public void testMissingProfileCreator() { final IpClient client = new IpClient(new SimpleTestTokenAuthenticator()); client.setProfileCreator(null); TestsHelper.initShouldFail(client, "profileCreator cannot be null"); }