@Test(expected = UserCreationException.class) public void createThrowsAUserCreationExceptionWhenTheUserCreatorDoes() throws Exception { doThrow(new UserCreationException("")).when(userCreator) .createUser(anyString(), anyString(), anyString(), anyString(), anyString()); instance.create(userInfo); }
public void create(Map<String, String> userInfo) throws UserCreationException { String userPid = userInfo.get(USER_PID); String userName = userInfo.get(USER_NAME); String password = userInfo.get(PASSWORD); String givenName = userInfo.get(GIVEN_NAME); String surname = userInfo.get(SURNAME); String emailAddress = userInfo.get(EMAIL_ADDRESS); String organization = userInfo.get(ORGANIZATION); String vreId = userInfo.get(VRE_ID); String vreRole = userInfo.get(VRE_ROLE); try { loginCreator.createLogin(userPid, userName, password, givenName, surname, emailAddress, organization); User user = userCreator.createUser(userPid, emailAddress, givenName, surname, organization); authorizationCreator.createAuthorization(vreId, user, vreRole); } catch (LoginCreationException e) { throw new UserCreationException(e); } catch (AuthorizationCreationException e) { throw new UserCreationException(e); } }
LocalUserCreator { public void create(Map<String, String> userInfo) throws UserCreationException { String userPid = userInfo.get(USER_PID); String userName = userInfo.get(USER_NAME); String password = userInfo.get(PASSWORD); String givenName = userInfo.get(GIVEN_NAME); String surname = userInfo.get(SURNAME); String emailAddress = userInfo.get(EMAIL_ADDRESS); String organization = userInfo.get(ORGANIZATION); String vreId = userInfo.get(VRE_ID); String vreRole = userInfo.get(VRE_ROLE); try { loginCreator.createLogin(userPid, userName, password, givenName, surname, emailAddress, organization); User user = userCreator.createUser(userPid, emailAddress, givenName, surname, organization); authorizationCreator.createAuthorization(vreId, user, vreRole); } catch (LoginCreationException e) { throw new UserCreationException(e); } catch (AuthorizationCreationException e) { throw new UserCreationException(e); } } }
LocalUserCreator { public void create(Map<String, String> userInfo) throws UserCreationException { String userPid = userInfo.get(USER_PID); String userName = userInfo.get(USER_NAME); String password = userInfo.get(PASSWORD); String givenName = userInfo.get(GIVEN_NAME); String surname = userInfo.get(SURNAME); String emailAddress = userInfo.get(EMAIL_ADDRESS); String organization = userInfo.get(ORGANIZATION); String vreId = userInfo.get(VRE_ID); String vreRole = userInfo.get(VRE_ROLE); try { loginCreator.createLogin(userPid, userName, password, givenName, surname, emailAddress, organization); User user = userCreator.createUser(userPid, emailAddress, givenName, surname, organization); authorizationCreator.createAuthorization(vreId, user, vreRole); } catch (LoginCreationException e) { throw new UserCreationException(e); } catch (AuthorizationCreationException e) { throw new UserCreationException(e); } } LocalUserCreator(LoginCreator loginCreator, UserCreator userCreator,
                          VreAuthorizationCrud authorizationCreator); }
LocalUserCreator { public void create(Map<String, String> userInfo) throws UserCreationException { String userPid = userInfo.get(USER_PID); String userName = userInfo.get(USER_NAME); String password = userInfo.get(PASSWORD); String givenName = userInfo.get(GIVEN_NAME); String surname = userInfo.get(SURNAME); String emailAddress = userInfo.get(EMAIL_ADDRESS); String organization = userInfo.get(ORGANIZATION); String vreId = userInfo.get(VRE_ID); String vreRole = userInfo.get(VRE_ROLE); try { loginCreator.createLogin(userPid, userName, password, givenName, surname, emailAddress, organization); User user = userCreator.createUser(userPid, emailAddress, givenName, surname, organization); authorizationCreator.createAuthorization(vreId, user, vreRole); } catch (LoginCreationException e) { throw new UserCreationException(e); } catch (AuthorizationCreationException e) { throw new UserCreationException(e); } } LocalUserCreator(LoginCreator loginCreator, UserCreator userCreator,
                          VreAuthorizationCrud authorizationCreator); void create(Map<String, String> userInfo); }
LocalUserCreator { public void create(Map<String, String> userInfo) throws UserCreationException { String userPid = userInfo.get(USER_PID); String userName = userInfo.get(USER_NAME); String password = userInfo.get(PASSWORD); String givenName = userInfo.get(GIVEN_NAME); String surname = userInfo.get(SURNAME); String emailAddress = userInfo.get(EMAIL_ADDRESS); String organization = userInfo.get(ORGANIZATION); String vreId = userInfo.get(VRE_ID); String vreRole = userInfo.get(VRE_ROLE); try { loginCreator.createLogin(userPid, userName, password, givenName, surname, emailAddress, organization); User user = userCreator.createUser(userPid, emailAddress, givenName, surname, organization); authorizationCreator.createAuthorization(vreId, user, vreRole); } catch (LoginCreationException e) { throw new UserCreationException(e); } catch (AuthorizationCreationException e) { throw new UserCreationException(e); } } LocalUserCreator(LoginCreator loginCreator, UserCreator userCreator,
                          VreAuthorizationCrud authorizationCreator); void create(Map<String, String> userInfo);  }