Пример #1
0
 @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());
 }
Пример #2
0
 @Test
 public void testHasDefaultProfileCreator() {
   final IpClient client = new IpClient(new SimpleTestTokenAuthenticator());
   client.init(null);
 }
Пример #3
0
 @Test
 public void testMissingProfileCreator() {
   final IpClient client = new IpClient(new SimpleTestTokenAuthenticator());
   client.setProfileCreator(null);
   TestsHelper.initShouldFail(client, "profileCreator cannot be null");
 }