TimesheetDayEntryChangePresenterImplEx extends TimesheetDayEntryChangePresenterImpl implements TimesheetDayEntryChangePresenterEx,
		TimesheetDayEntryChangeViewEx.Observer { @Override public void onProjectChanged() { if (!presenting) { return; } saveToModel(); if (hoursChangeObserver != null) { if (oldProject != null) { hoursChangeObserver.hoursChanged(oldProject); } oldProject = getTimesheetDayEntry().getProject(); if (getTimesheetDayEntry().getProject() != null) { hoursChangeObserver.hoursChanged(getTimesheetDayEntry().getProject()); } } } TimesheetDayEntryChangePresenterImplEx(Map<String, Object> context, TimesheetDayEntryChangeViewEx view, Presenter returnPresenter, TimesheetDayEntryService service);  TimesheetDayEntryChangePresenterImplEx(Map<String, Object> context, TimesheetDayEntryChangeView view, Presenter returnPresenter,
			SubviewCapablePresenter capablePresenter, TimesheetDayEntryService service); @Override TimesheetDayEntryChangeViewEx getView(); @Override void startPresenting(); @Override void loadFromModel(); @Override boolean validateFields(); @Override void saveToModel(); @Override void onProjectChanged(); @Override void onHoursChanged(); @Override void onSave(); @Override void onCancel(); @Override void onRemove(); @Override List<Project> getProjectList(); @Override void setProjectList(List<Project> projectList); @Override void setHoursChangeObserver(HoursChangeObserver observer);  }
@Test public void testOnProjectChanged() { presenterImpl.presenting = true; presenterImpl.oldProject = project; Project alt = new Project("alt"); when(view.getProject()).thenReturn(alt); when(view.getHours()).thenReturn("01:00"); presenterImpl.onProjectChanged(); assertEquals(alt, dayEntry.getProject()); assertEquals("01:00", dayEntry.getHours()); verify(view).getProject(); verify(observer).hoursChanged(alt); verify(observer).hoursChanged(project); }
@Test public void testOnProjectChangedNoOld() { presenterImpl.presenting = true; presenterImpl.oldProject = null; Project alt = new Project("alt"); when(view.getProject()).thenReturn(alt); when(view.getHours()).thenReturn("01:00"); presenterImpl.onProjectChanged(); assertEquals(alt, dayEntry.getProject()); assertEquals("01:00", dayEntry.getHours()); verify(view).getProject(); verify(observer).hoursChanged(alt); verify(observer, never()).hoursChanged(project); }
@Test public void testOnProjectChangedNotPresenting() { presenterImpl.presenting = false; presenterImpl.oldProject = null; presenterImpl.onProjectChanged(); verify(view, never()).getProject(); verify(observer, never()).hoursChanged(any(Project.class)); }