TimesheetChangePresenterImplEx extends TimesheetChangePresenterImpl implements HoursChangeObserver { @Override public void onSave() { boolean valid = true; valid = valid && getView().checkAllFieldsValid(); for (TimesheetDayChangePresenterEx dayPresenter : dayPresenters) { valid = valid && dayPresenter.validateFields(); } if (!valid) { return; } super.onSave(); } TimesheetChangePresenterImplEx(Map<String, Object> context, PresenterFactoryEx presenterFactory, TimesheetChangeViewEx view, Presenter returnPresenter,
			TimesheetService service, ProjectService projectService);  TimesheetChangePresenterImplEx(Map<String, Object> context, PresenterFactoryEx presenterFactory, TimesheetChangeViewEx view, Presenter returnPresenter,
			SubviewCapablePresenter capablePresenter, TimesheetService service, ProjectService projectService);  TimesheetChangePresenterImplEx(Map<String, Object> context, TimesheetChangeViewEx view,
			Presenter returnPresenter, TimesheetService service); @Override TimesheetChangeViewEx getView(); @Override void startPresenting(); @Override void onSave(); @Override void onRemove(); @Override void hoursChanged(Project project);  }
@SuppressWarnings("unchecked") @Test public void testOnSave() { List<TimesheetDayChangePresenterEx> dayPresenters = new ArrayList<TimesheetDayChangePresenterEx>(); dayPresenters.add(dayChangePresenter); dayPresenters.add(dayChangePresenter); presenterImpl.dayPresenters = dayPresenters; when(view.checkAllFieldsValid()).thenReturn(true); when(dayChangePresenter.validateFields()).thenReturn(true); presenterImpl.onSave(); verify(view, atLeast(1)).checkAllFieldsValid(); verify(dayChangePresenter, times(2)).validateFields(); verify(dayChangePresenter, times(2)).saveToModel(); verify(service).updateExistingTimesheet(eq(timesheet), anyMap()); }