@Test void uploadAddsPrimedMappingsToPrimingContext() throws Exception { final List<PrimedMapping> primedMappings = asList( new PrimedMapping(APP_REQUEST_1, new DefaultingQueue() {{ add(APP_RESPONSE_1); setDefault(staticDefault(APP_RESPONSE_2)); }}), new PrimedMapping(APP_REQUEST_2, new DefaultingQueue() {{ add(APP_RESPONSE_2); setDefault(staticDefault(APP_RESPONSE_1)); }}) ); uploader.upload(primedMappings); verify(primingContext).add(APP_REQUEST_1, APP_RESPONSE_1); verify(primingContext).addDefault(APP_REQUEST_1, staticDefault(APP_RESPONSE_2)); verify(primingContext).add(APP_REQUEST_2, APP_RESPONSE_2); verify(primingContext).addDefault(APP_REQUEST_2, staticDefault(APP_RESPONSE_1)); }
public void upload(List<PrimedMapping> primedMappings) { primedMappings.forEach(primedMapping -> { final DefaultingQueue defaultingQueue = primedMapping.getResponses(); defaultingQueue.getPrimed().forEach(appResponse -> primingContext.add(primedMapping.getRequest(), appResponse)); defaultingQueue.getDefault().map(defaultResponse -> primingContext.addDefault(primedMapping.getRequest(), defaultResponse)); }); }
PrimedMappingUploader { public void upload(List<PrimedMapping> primedMappings) { primedMappings.forEach(primedMapping -> { final DefaultingQueue defaultingQueue = primedMapping.getResponses(); defaultingQueue.getPrimed().forEach(appResponse -> primingContext.add(primedMapping.getRequest(), appResponse)); defaultingQueue.getDefault().map(defaultResponse -> primingContext.addDefault(primedMapping.getRequest(), defaultResponse)); }); } }
PrimedMappingUploader { public void upload(List<PrimedMapping> primedMappings) { primedMappings.forEach(primedMapping -> { final DefaultingQueue defaultingQueue = primedMapping.getResponses(); defaultingQueue.getPrimed().forEach(appResponse -> primingContext.add(primedMapping.getRequest(), appResponse)); defaultingQueue.getDefault().map(defaultResponse -> primingContext.addDefault(primedMapping.getRequest(), defaultResponse)); }); } PrimedMappingUploader(PrimingContext primingContext); }
PrimedMappingUploader { public void upload(List<PrimedMapping> primedMappings) { primedMappings.forEach(primedMapping -> { final DefaultingQueue defaultingQueue = primedMapping.getResponses(); defaultingQueue.getPrimed().forEach(appResponse -> primingContext.add(primedMapping.getRequest(), appResponse)); defaultingQueue.getDefault().map(defaultResponse -> primingContext.addDefault(primedMapping.getRequest(), defaultResponse)); }); } PrimedMappingUploader(PrimingContext primingContext); void upload(List<PrimedMapping> primedMappings); }
PrimedMappingUploader { public void upload(List<PrimedMapping> primedMappings) { primedMappings.forEach(primedMapping -> { final DefaultingQueue defaultingQueue = primedMapping.getResponses(); defaultingQueue.getPrimed().forEach(appResponse -> primingContext.add(primedMapping.getRequest(), appResponse)); defaultingQueue.getDefault().map(defaultResponse -> primingContext.addDefault(primedMapping.getRequest(), defaultResponse)); }); } PrimedMappingUploader(PrimingContext primingContext); void upload(List<PrimedMapping> primedMappings);  }