@Test @SuppressWarnings("ResultOfMethodCallIgnored") public void testCreateAccount() { context.checking(new Expectations() {{ oneOf(setupActivity).setAuthorName(authorName); oneOf(setupActivity).setPassword(password); oneOf(setupActivity).getAuthorName(); will(returnValue(authorName)); oneOf(setupActivity).getPassword(); will(returnValue(password)); oneOf(accountManager).createAccount(authorName, password); will(returnValue(true)); }}); SetupControllerImpl s = new SetupControllerImpl(accountManager, ioExecutor, estimator); s.setSetupActivity(setupActivity); AtomicBoolean called = new AtomicBoolean(false); s.setAuthorName(authorName); s.setPassword(password); s.createAccount(result -> called.set(true)); assertTrue(called.get()); }
@Override public void createAccount() { SetupActivity setupActivity = this.setupActivity; UiResultHandler<Boolean> resultHandler = new UiResultHandler<Boolean>(setupActivity) { @Override public void onResultUi(Boolean result) { if (setupActivity == null) throw new IllegalStateException(); setupActivity.showApp(); } }; createAccount(resultHandler); }
SetupControllerImpl extends PasswordControllerImpl implements SetupController { @Override public void createAccount() { SetupActivity setupActivity = this.setupActivity; UiResultHandler<Boolean> resultHandler = new UiResultHandler<Boolean>(setupActivity) { @Override public void onResultUi(Boolean result) { if (setupActivity == null) throw new IllegalStateException(); setupActivity.showApp(); } }; createAccount(resultHandler); } }
SetupControllerImpl extends PasswordControllerImpl implements SetupController { @Override public void createAccount() { SetupActivity setupActivity = this.setupActivity; UiResultHandler<Boolean> resultHandler = new UiResultHandler<Boolean>(setupActivity) { @Override public void onResultUi(Boolean result) { if (setupActivity == null) throw new IllegalStateException(); setupActivity.showApp(); } }; createAccount(resultHandler); } @Inject  SetupControllerImpl(AccountManager accountManager,
			@IoExecutor Executor ioExecutor,
			PasswordStrengthEstimator strengthEstimator); }
SetupControllerImpl extends PasswordControllerImpl implements SetupController { @Override public void createAccount() { SetupActivity setupActivity = this.setupActivity; UiResultHandler<Boolean> resultHandler = new UiResultHandler<Boolean>(setupActivity) { @Override public void onResultUi(Boolean result) { if (setupActivity == null) throw new IllegalStateException(); setupActivity.showApp(); } }; createAccount(resultHandler); } @Inject  SetupControllerImpl(AccountManager accountManager,
			@IoExecutor Executor ioExecutor,
			PasswordStrengthEstimator strengthEstimator); @Override void setSetupActivity(SetupActivity setupActivity); @Override boolean needToShowDozeFragment(); @Override void setAuthorName(String authorName); @Override void setPassword(String password); @Override void showPasswordFragment(); @Override void showDozeFragment(); @Override void createAccount(); }
SetupControllerImpl extends PasswordControllerImpl implements SetupController { @Override public void createAccount() { SetupActivity setupActivity = this.setupActivity; UiResultHandler<Boolean> resultHandler = new UiResultHandler<Boolean>(setupActivity) { @Override public void onResultUi(Boolean result) { if (setupActivity == null) throw new IllegalStateException(); setupActivity.showApp(); } }; createAccount(resultHandler); } @Inject  SetupControllerImpl(AccountManager accountManager,
			@IoExecutor Executor ioExecutor,
			PasswordStrengthEstimator strengthEstimator); @Override void setSetupActivity(SetupActivity setupActivity); @Override boolean needToShowDozeFragment(); @Override void setAuthorName(String authorName); @Override void setPassword(String password); @Override void showPasswordFragment(); @Override void showDozeFragment(); @Override void createAccount();  }