### Question:
ApnsFeedbackService extends AbstractScheduledService { @Override protected void runOneIteration() throws Exception { Map<String,Date> inactiveDevices = apnsService.getInactiveDevices(); for (String deviceToken : inactiveDevices.keySet()) { Date inactiveAsOf = inactiveDevices.get(deviceToken); Optional<WebPushUser> userOptional = getUserIfValidTime(deviceToken, inactiveAsOf); if (userOptional.isPresent()) { userOptional.get().setActive(false); userOptional.get().setActiveTimestamp(System.currentTimeMillis()); log.info("APNS FEEDBACK: Marking a user inActive. " + deviceToken); webPushStore.updateWebPushUser(userOptional.get()); } } } ApnsFeedbackService(ApnsService apnsService, ApnsConfiguration apnsConfiguration, WebPushStore webPushStore);   }### Answer:
@Test public void testRunOneIteration() throws Exception { Map<String, Date> inActiveDevices = new HashMap<String, Date>(); inActiveDevices.put("devicetoken1", new Date()); inActiveDevices.put("devicetoken2", new Date()); inActiveDevices.put("devicetoken3", new Date()); inActiveDevices.put("devicetoken4", new Date()); when(apnsService.getInactiveDevices()).thenReturn(inActiveDevices); WebPushUser webPushUser = new WebPushUserBuilder() .setUserId("USERID") .setActive(true) .setDeviceToken("DEVICETOKEN1") .setIsActiveTimestamp(System.currentTimeMillis() + 86400000) .setWebsitePushId("websitepushId") .build(); when(webPushStore.getWebPushUserMostRecentlyUpdatedByDeviceToken(anyString())).thenReturn(Optional.of(webPushUser)); apnsFeedbackService.runOneIteration(); }