@Test void handleReturnsPrimedResponseIfPrimingKeyExistsInPrimingContext() throws JsonProcessingException { final Response got = appRequestHandler.handle(request); assertThat(got).isEqualTo(appResponse); }
@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);  }