### Question:
ActiveSyncServlet extends HttpServlet { @Override @Transactional protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { IContinuation continuation = (IContinuation) request.getAttribute(RequestProperties.CONTINUATION); if (continuation == null) { throw new IllegalStateException("Requests must be handled by " + PushContinuationFilter.class.getSimpleName()); } logger.debug( "query = {}, m = {}, num = {}", request.getQueryString(), request.getMethod(), continuation.getReqId()); if (continuation.needsContinuationHandling()) { handleContinuation(request, response, continuation); return; } Credentials credentials = (Credentials) request.getAttribute(RequestProperties.CREDENTIALS); if (credentials == null) { throw new IllegalStateException("Credentials must be handled by " + AuthenticationFilter.class.getSimpleName()); } final ActiveSyncRequest asrequest = getActiveSyncRequest(request); checkAuthorizedDevice(asrequest, credentials); if (policyService.needProvisionning(asrequest, credentials.getUser())) { forgetDeviceRelatedData(asrequest, credentials); logger.warn("forcing device (ua: {}) provisioning", asrequest.getUserAgent()); sendNeedProvisionningResponse(response); return; } else { logger.debug("policy used = {}", asrequest.getMsPolicyKey()); } processActiveSyncMethod(continuation, credentials, asrequest.getDeviceId(), asrequest, response); } catch (RuntimeException e) { logger.error(e.getMessage(), e); throw e; } catch (AuthenticationException e) { logger.info(e.getMessage()); httpErrorResponder.returnHttpUnauthorized(request, response); } } @Inject @VisibleForTesting  ActiveSyncServlet(SessionService sessionService, 
			ContinuationService continuationService,
			IBackend backend, DeviceService deviceService,
			PolicyService policyService,
			ResponderImpl.Factory responderFactory, Handlers handlers,
			LoggerService loggerService, @Named(LoggerModule.AUTH)Logger authLogger,
			HttpErrorResponder httpErrorResponder); @Override void init();  }### Answer:
@Test public void testEnsureThatProcessActiveSyncMethodCallCloseResources() throws ServletException, IOException, DaoException { UserDataRequest userDataRequest = mocksControl.createMock(UserDataRequest.class); expect(userDataRequest.getCommand()).andReturn(command).atLeastOnce(); ActiveSyncServlet activeSyncServlet = createActiveSyncServlet(userDataRequest); mocksControl.replay(); activeSyncServlet.doPost(request, response); mocksControl.verify(); }