### Question:
UserManagementAndSecurityModule implements eu.cloud4soa.api.soa.UserManagementAndSecurityModule { @Override public UserInstance getUserInstance(String userInstanceUriId) throws SOAException { logger.debug("received userInstanceUriId: "+ userInstanceUriId); eu.cloud4soa.api.datamodel.core.UserInstance userInstanceRetrieved; try { userInstanceRetrieved = userProfilesRepository.getUserInstance(userInstanceUriId); } catch (RepositoryException ex) { throw new SOAException(Response.Status.INTERNAL_SERVER_ERROR, ex.getMessage()); } if(userInstanceRetrieved==null){ throw new ResourceException("The requested resource " + userInstanceUriId + " does not exists."); } return userInstanceRetrieved; }  @Required void setRepositoryManager(RepositoryManager repositoryManager); @Required void setUserProfilesRepository(UserProfilesRepository userProfilesRepository); @Required void setPaaSOfferingProfilesRepository(PaaSOfferingProfilesRepository paaSOfferingProfilesRepository); @Override Response createNewAccount(UserInstance userInstance ,String username, String password); @Override Response storeTurtleUserProfile(String userProfile, String username, String password); @Override UserInstance getUserInstance(String userInstanceUriId); @Override Response updateUserInstance(UserInstance userInstance); @Override //TODO Input pending of actual logging implementation /* UserInstance authenticateUser (String username, String password) throws SOAException { */ UserInstance authenticateUser(String username, String password); @Override boolean isAccountNameInUse(String accountName); @Override Response storeUserCredentialsForPaaS(String userInstanceUriId, String paaSInstanceUriId, String publicKey, String secretKey, String accountName); @Override Response removeUserCredentialsForPaaS(String userInstanceUriId, String paaSInstanceUriId); @Override Response updateUserCredentialsForPaaS(String userInstanceUriId, String paaSInstanceUriId, String publicKey, String secretKey, String accountName); @Override UserPaaSCredentials readUserCredentialsForPaaS(String userInstanceUriId, String paaSInstanceUriId); @Override List<UserPaaSCredentials> readAllUserCredentialsForPaaS(String userInstanceUriId); void close();  }### Answer:
@Test public void TestGetUserInstance() { UserInstance retrivedUserInstance = null; try { retrivedUserInstance = userManagementAndSecurityModule.getUserInstance(userId); } catch (SOAException ex) { Assert.fail("getUserInstance method has thrown an exception!"); } Assert.assertEquals("retrieve UriId: ", userInstance.getUriId(), retrivedUserInstance.getUriId()); Assert.assertEquals("retrieve Accountname", userInstance.getAccountname(), retrivedUserInstance.getAccountname()); Assert.assertEquals("retrieve FirstName", userInstance.getFirstName(), retrivedUserInstance.getFirstName()); Assert.assertEquals("retrieve Surname", userInstance.getSurname(), retrivedUserInstance.getSurname()); Assert.assertEquals("retrieve Geekcode", userInstance.getGeekcode(), retrivedUserInstance.getGeekcode()); Assert.assertEquals("retrieve Cloud4SoaAccountUriId", userInstance.getCloud4SoaAccountUriId(), retrivedUserInstance.getCloud4SoaAccountUriId()); }
@Test public void TestGetUserInstance1() { try { UserInstance retrivedUserInstance = userManagementAndSecurityModule.getUserInstance(userId); } catch (ResourceException e) { Assert.fail("userManagementAndSecurityModule in not able to retrieve an existing user: " + userId); } catch (SOAException ex) { Assert.fail("getUserInstance method has thrown an exception!"); } try { UserInstance retrivedUserInstance = userManagementAndSecurityModule.getUserInstance("yosu1"); Assert.fail("userManagementAndSecurityModule is able to retrieve a non existing user: " + userId); } catch (ResourceException e) { Response resp = e.getResponse(); Status.fromStatusCode(resp.getStatus()).equals(Status.BAD_REQUEST); Assert.assertTrue("Different exception code", Status.fromStatusCode(resp.getStatus()).equals(Status.BAD_REQUEST)); } catch (SOAException ex) { Assert.fail("getUserInstance method has thrown an exception!"); } }