@Test void handleAddsRequestToFailedRequestsIfPrimingIsNotFound() throws Exception { when(primingContext.getResponse(appRequest)).thenReturn(empty()); try{ appRequestHandler.handle(request); } catch (Exception e) { verify(failedRequests).add(appRequest); } }
@Override public Response handle(Request request) { final AppRequest appRequest = appRequestFactory.create(request); final Optional<AppResponse> primedResponseOpt = primingContext.getResponse(appRequest); if(!primedResponseOpt.isPresent()) { failedRequests.add(appRequest); throw new PrimingNotFoundException(appRequest); } final AppResponse zombieResponse = primedResponseOpt.get(); callHistory.add(new Exchange(appRequest, zombieResponse)); return zombieResponse; }
AppRequestHandler implements RequestHandler { @Override public Response handle(Request request) { final AppRequest appRequest = appRequestFactory.create(request); final Optional<AppResponse> primedResponseOpt = primingContext.getResponse(appRequest); if(!primedResponseOpt.isPresent()) { failedRequests.add(appRequest); throw new PrimingNotFoundException(appRequest); } final AppResponse zombieResponse = primedResponseOpt.get(); callHistory.add(new Exchange(appRequest, zombieResponse)); return zombieResponse; } }
AppRequestHandler implements RequestHandler { @Override public Response handle(Request request) { final AppRequest appRequest = appRequestFactory.create(request); final Optional<AppResponse> primedResponseOpt = primingContext.getResponse(appRequest); if(!primedResponseOpt.isPresent()) { failedRequests.add(appRequest); throw new PrimingNotFoundException(appRequest); } final AppResponse zombieResponse = primedResponseOpt.get(); callHistory.add(new Exchange(appRequest, zombieResponse)); return zombieResponse; } AppRequestHandler(PrimingContext primingContext,
                             CallHistory callHistory,
                             FixedCapacityCache<AppRequest> failedRequests,
                             AppRequestFactory appRequestFactory); }
AppRequestHandler implements RequestHandler { @Override public Response handle(Request request) { final AppRequest appRequest = appRequestFactory.create(request); final Optional<AppResponse> primedResponseOpt = primingContext.getResponse(appRequest); if(!primedResponseOpt.isPresent()) { failedRequests.add(appRequest); throw new PrimingNotFoundException(appRequest); } final AppResponse zombieResponse = primedResponseOpt.get(); callHistory.add(new Exchange(appRequest, zombieResponse)); return zombieResponse; } AppRequestHandler(PrimingContext primingContext,
                             CallHistory callHistory,
                             FixedCapacityCache<AppRequest> failedRequests,
                             AppRequestFactory appRequestFactory); @Override Response handle(Request request); }
AppRequestHandler implements RequestHandler { @Override public Response handle(Request request) { final AppRequest appRequest = appRequestFactory.create(request); final Optional<AppResponse> primedResponseOpt = primingContext.getResponse(appRequest); if(!primedResponseOpt.isPresent()) { failedRequests.add(appRequest); throw new PrimingNotFoundException(appRequest); } final AppResponse zombieResponse = primedResponseOpt.get(); callHistory.add(new Exchange(appRequest, zombieResponse)); return zombieResponse; } AppRequestHandler(PrimingContext primingContext,
                             CallHistory callHistory,
                             FixedCapacityCache<AppRequest> failedRequests,
                             AppRequestFactory appRequestFactory); @Override Response handle(Request request);  }