### Question:
UserManager extends AbstractManager implements IUserManager { @Override public synchronized ResultStatus registerUser(final String username, final String password, final String pin) throws NoPeerConnectionException { logger.debug("REGISTER - Username: {}", username); ResultStatus res = ResultStatus.error("Could not register user."); UserCredentials credentials = new UserCredentials(username, password, pin); try { IProcessComponent<Void> registerProc = getH2HUserManager().createRegisterProcess(credentials); registerProc.execute(); if (isRegistered(credentials.getUserId())) { res = ResultStatus.ok(); notifyRegister(username); } } catch (ProcessExecutionException | InvalidProcessStateException pex) { logger.warn("Register process failed (user={})", username, pex); } return res; } @Inject  UserManager(final INodeManager nodeManager, final MessageBus messageBus); @Override synchronized ResultStatus registerUser(final String username, final String password, final String pin); @Override boolean isRegistered(final String userName); @Override synchronized ResultStatus loginUser(final String username, final String password, final String pin,
			final Path rootPath); @Override boolean isLoggedIn(); @Override synchronized ResultStatus logoutUser();  }### Answer:
@Test public void testAlreadyRegistered() throws NoPeerConnectionException { ResultStatus res = client.getUserManager().registerUser( userCredentials.getUserId(), userCredentials.getPassword(), userCredentials.getPin()); assertTrue(res.isOk()); Mockito.verify(client.getMessageBus(), Mockito.times(1)).publish(Mockito.anyObject()); for (int i = 0; i < network.size(); ++i) { ClientContext cc = createClientContext(network.get(i)); IUserManager usrMgr = cc.getUserManager(); res = usrMgr.registerUser(userCredentials.getUserId(), userCredentials.getPassword(), userCredentials.getPin()); assertTrue(res.isError()); Mockito.verify(cc.getMessageBus(), Mockito.never()).publish(Mockito.anyObject()); } }