ContractApplicationAddPresenterImplEx extends ContractApplicationAddPresenterImpl implements ProductChoiceAwareObserver { @Override public void onProductChoiceModified() { saveToModel(); view.setMonthlyFeeStr(getContractApplication().getMonthlyFeeStr()); } ContractApplicationAddPresenterImplEx(Map<String, Object> context, ContractApplicationAddView view, Presenter returnPresenter, ContractApplicationService service); @Override void onProductChoiceModified();  }
@Test public void testOnProductChoiceModified() { pres.startPresenting(); assertTrue(pres.getContractApplication().isLazinessProtection()); assertFalse(pres.getContractApplication().isRetirementProtection()); when(view.isLazinessProtection()).thenReturn(false); when(view.isRetirementProtection()).thenReturn(true); when(view.checkAllFieldsValid()).thenReturn(true); pres.onProductChoiceModified(); assertFalse(pres.getContractApplication().isLazinessProtection()); assertTrue(pres.getContractApplication().isRetirementProtection()); verify(view).setMonthlyFeeStr("11.11"); }
@Test public void testOnProductChoiceModifiedAll() { pres.startPresenting(); assertTrue(pres.getContractApplication().isLazinessProtection()); assertFalse(pres.getContractApplication().isRetirementProtection()); when(view.isLazinessProtection()).thenReturn(true); when(view.isRetirementProtection()).thenReturn(true); when(view.checkAllFieldsValid()).thenReturn(true); pres.onProductChoiceModified(); assertTrue(pres.getContractApplication().isLazinessProtection()); assertTrue(pres.getContractApplication().isRetirementProtection()); verify(view).setMonthlyFeeStr("99.99"); }