### Question:
DBReportRequestStateManager extends DBManager<ReportRequestState> implements ReportRequestStateManager { @Override public final List<ReportRequestState> getLateDeviceStates() { Criterion criterion = Restrictions.le("dueDate", new Date()); return getWithCriteria(Collections.singletonList(criterion)); } DBReportRequestStateManager(final SessionFactory sessionFactory); @Override final ReportRequestState getState(final Device device); @Override final List<ReportRequestState> getLateDeviceStates(); @Override final ReportRequestState saveState(final ReportRequestState state); @Override final void deleteState(final ReportRequestState state);  }### Answer:
@Test public final void testGetLateDeviceStates() { final int timeOffsetMs = 5000; Date checkDate = new Date(); DBReportRequestStateManager mgr = new DBReportRequestStateManager(sessionFactory); ReportRequestState lateState = getTestReportRequestState(testDevices.get(0)); lateState.setDueDate(new Date(checkDate.getTime() - timeOffsetMs)); ReportRequestState nonLateState = getTestReportRequestState(testDevices.get(1)); nonLateState.setDueDate(new Date(checkDate.getTime() + timeOffsetMs)); mgr.saveState(lateState); mgr.saveState(nonLateState); List<ReportRequestState> lateDeviceStates = mgr.getLateDeviceStates(); Assert.assertEquals(lateDeviceStates.size(), 1); Assert.assertEquals(lateDeviceStates.get(0).getDevice(), lateState.getDevice()); }