@Test public void testChangePasswordReturnsTrue() { context.checking(new Expectations() {{ oneOf(accountManager).changePassword(oldPassword, newPassword); will(returnValue(true)); }}); PasswordControllerImpl p = new PasswordControllerImpl(accountManager, ioExecutor, estimator); AtomicBoolean capturedResult = new AtomicBoolean(false); p.changePassword(oldPassword, newPassword, capturedResult::set); assertTrue(capturedResult.get()); }
@Override public void changePassword(String oldPassword, String newPassword, ResultHandler<Boolean> resultHandler) { ioExecutor.execute(() -> { boolean changed = accountManager.changePassword(oldPassword, newPassword); resultHandler.onResult(changed); }); }
PasswordControllerImpl implements PasswordController { @Override public void changePassword(String oldPassword, String newPassword, ResultHandler<Boolean> resultHandler) { ioExecutor.execute(() -> { boolean changed = accountManager.changePassword(oldPassword, newPassword); resultHandler.onResult(changed); }); } }
PasswordControllerImpl implements PasswordController { @Override public void changePassword(String oldPassword, String newPassword, ResultHandler<Boolean> resultHandler) { ioExecutor.execute(() -> { boolean changed = accountManager.changePassword(oldPassword, newPassword); resultHandler.onResult(changed); }); } @Inject  PasswordControllerImpl(AccountManager accountManager,
			@IoExecutor Executor ioExecutor,
			PasswordStrengthEstimator strengthEstimator); }
PasswordControllerImpl implements PasswordController { @Override public void changePassword(String oldPassword, String newPassword, ResultHandler<Boolean> resultHandler) { ioExecutor.execute(() -> { boolean changed = accountManager.changePassword(oldPassword, newPassword); resultHandler.onResult(changed); }); } @Inject  PasswordControllerImpl(AccountManager accountManager,
			@IoExecutor Executor ioExecutor,
			PasswordStrengthEstimator strengthEstimator); @Override float estimatePasswordStrength(String password); @Override void validatePassword(String password,
			ResultHandler<Boolean> resultHandler); @Override void changePassword(String oldPassword, String newPassword,
			ResultHandler<Boolean> resultHandler); }
PasswordControllerImpl implements PasswordController { @Override public void changePassword(String oldPassword, String newPassword, ResultHandler<Boolean> resultHandler) { ioExecutor.execute(() -> { boolean changed = accountManager.changePassword(oldPassword, newPassword); resultHandler.onResult(changed); }); } @Inject  PasswordControllerImpl(AccountManager accountManager,
			@IoExecutor Executor ioExecutor,
			PasswordStrengthEstimator strengthEstimator); @Override float estimatePasswordStrength(String password); @Override void validatePassword(String password,
			ResultHandler<Boolean> resultHandler); @Override void changePassword(String oldPassword, String newPassword,
			ResultHandler<Boolean> resultHandler);  }