### Question:
DBReportRequestStateManager extends DBManager<ReportRequestState> implements ReportRequestStateManager { @Override public final ReportRequestState getState(final Device device) { Criterion crit = Restrictions.eq("device", device); List<ReportRequestState> results = getWithCriteria(Collections.singletonList(crit)); if (results.isEmpty()) { return null; } else { LOGGER.debug("Retrieved ReportRequestState: {}", results.get(0)); return results.get(0); } } 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 testGetNonexistentState() { DBReportRequestStateManager mgr = new DBReportRequestStateManager(sessionFactory); Assert.assertNull(mgr.getState(testDevices.get(0))); }
@Test public final void testUpdateNonexistentState() { DBReportRequestStateManager mgr = new DBReportRequestStateManager(sessionFactory); ReportRequestState newState = getTestReportRequestState( testDevices.get(0) ); newState.setDueDate(DeviceGroup.MINUTE_MS_INTERVAL); mgr.update(newState); Assert.assertEquals(mgr.getState(testDevices.get(0)), newState); }