### Question:
ServiceReaper implements Runnable { @Override public void run() { try { if (logger.isTraceEnabled()) { logger.trace("Purging expired service records"); } if (sm==null) { sm = new ServiceAdminManager(); } sm.removeExpiredEntries(); } catch (Exception e) { logger.warn(e.getCause()); } }  @Override void run();  }### Answer:
@Test @FunctionalTest(id = "RunTTLTest", description = "Test TTL of a service record") public void testReaping() throws Exception { JSONObject date = new JSONObject(); Calendar c = Calendar.getInstance(); try { date.put("$date", DateUtil.toUTCFormat(c.getTime())); } catch (JSONException e) { e.printStackTrace(); } Calendar c1 = Calendar.getInstance(); JSONObject jo1 = TestValueConstants.getJSONWithMandatoryAttributes(); for (int i = 0; i < 2; i++) { jo1.put(ServiceBasicAttributeNames.SERVICE_ENDPOINT_ID.getAttributeName(), UUID.randomUUID().toString()); JSONObject date1 = new JSONObject(); c1.add(Calendar.SECOND, 1); try { date1.put("$date", DateUtil.toUTCFormat(c1.getTime())); } catch (JSONException e) { e.printStackTrace(); } jo1.put(ServiceBasicAttributeNames.SERVICE_EXPIRE_ON .getAttributeName(), date1); adminMgr.addService(jo1); } int size = adminMgr.findAll().size(); assertEquals(2, size); Thread.sleep(3000); ServiceReaper r = new ServiceReaper(); r.run(); int size1 = adminMgr.findAll().size(); assertEquals(0, size1); }