@Test public void getRequestTimeParameterWorks() { @SuppressWarnings("serial") AbstractServlet srv = new AbstractServlet() {}; HttpServletRequest req = Mockito.mock(HttpServletRequest.class); String timeString = "2013-12-18T20:00Z"; Mockito.when(req.getParameter("time")).thenReturn(timeString); Assert.assertEquals(new ScheduledTime(timeString), srv.getRequestTime(req)); }
protected ScheduledTime getRequestTime(HttpServletRequest req) { String t = req.getParameter(CelosClient.TIME_PARAM); if (t == null) { return new ScheduledTime(DateTime.now(DateTimeZone.UTC)); } else { return new ScheduledTime(t); } }
AbstractServlet extends HttpServlet { protected ScheduledTime getRequestTime(HttpServletRequest req) { String t = req.getParameter(CelosClient.TIME_PARAM); if (t == null) { return new ScheduledTime(DateTime.now(DateTimeZone.UTC)); } else { return new ScheduledTime(t); } } }
AbstractServlet extends HttpServlet { protected ScheduledTime getRequestTime(HttpServletRequest req) { String t = req.getParameter(CelosClient.TIME_PARAM); if (t == null) { return new ScheduledTime(DateTime.now(DateTimeZone.UTC)); } else { return new ScheduledTime(t); } }  }
AbstractServlet extends HttpServlet { protected ScheduledTime getRequestTime(HttpServletRequest req) { String t = req.getParameter(CelosClient.TIME_PARAM); if (t == null) { return new ScheduledTime(DateTime.now(DateTimeZone.UTC)); } else { return new ScheduledTime(t); } }  @Override void service(HttpServletRequest req, HttpServletResponse res); }
AbstractServlet extends HttpServlet { protected ScheduledTime getRequestTime(HttpServletRequest req) { String t = req.getParameter(CelosClient.TIME_PARAM); if (t == null) { return new ScheduledTime(DateTime.now(DateTimeZone.UTC)); } else { return new ScheduledTime(t); } }  @Override void service(HttpServletRequest req, HttpServletResponse res); static final String SCHEDULER_ATTR; }