### Question:
ParseAuthenticationManager { public void register(final String authType, AuthenticationCallback callback) { if (authType == null) { throw new IllegalArgumentException("Invalid authType: " + null); } synchronized (lock) { if (this.callbacks.containsKey(authType)) { throw new IllegalStateException("Callback already registered for <" + authType + ">: " + this.callbacks.get(authType)); } this.callbacks.put(authType, callback); } if (ParseAnonymousUtils.AUTH_TYPE.equals(authType)) { return; } controller.getAsync(false).onSuccessTask(new Continuation<ParseUser, Task<Void>>() { @Override public Task<Void> then(Task<ParseUser> task) throws Exception { ParseUser user = task.getResult(); if (user != null) { return user.synchronizeAuthDataAsync(authType); } return null; } }); } ParseAuthenticationManager(ParseCurrentUserController controller); void register(final String authType, AuthenticationCallback callback); Task<Boolean> restoreAuthenticationAsync(String authType, final Map<String, String> authData); Task<Void> deauthenticateAsync(String authType);  }### Answer:
@Test public void testRegisterMultipleShouldThrow() { when(controller.getAsync(false)).thenReturn(Task.<ParseUser>forResult(null)); AuthenticationCallback provider2 = mock(AuthenticationCallback.class); manager.register("test_provider", provider); thrown.expect(IllegalStateException.class); manager.register("test_provider", provider2); }
@Test public void testRegisterAnonymous() { manager.register("anonymous", mock(AuthenticationCallback.class)); verifyNoMoreInteractions(controller); }
@Test public void testRegister() { ParseUser user = mock(ParseUser.class); when(controller.getAsync(false)).thenReturn(Task.forResult(user)); manager.register("test_provider", provider); verify(controller).getAsync(false); verify(user).synchronizeAuthDataAsync("test_provider"); }