### Question:
ContextCaster { public void cast() { if (!inputOK()) { logger.warn("No deployed services found. Not going to cast context."); return; } int nThreads = getNThreads(); this.executor = Executors.newFixedThreadPool(nThreads); logger.info("Passing context to deployed services on choreograghy " + chor.getId()); for (Service consumer : chor.getServices()) { castContextsToConsumer(consumer); } waitContextCasting(); } ContextCaster(Choreography chor); void cast();  }### Answer:
@Test public void shouldPassAirlineProxifiedAddressToTravelAgency() throws ContextNotSentException, ServiceInstanceNotFoundException { this.setUpBusUris(); ContextSender sender = mock(ContextSender.class); ContextSenderFactory.testing = true; ContextSenderFactory.senderForTesting = sender; ContextCaster caster = new ContextCaster(models.getChoreography()); caster.cast(); List<String> expectedAirlineUrisList = new ArrayList<String>(); expectedAirlineUrisList.add(AIRLINE_PROXIFIED_URI); verify(sender).sendContext(TRAVEL_AGENCY_URI, AIRLINE, AIRLINE, expectedAirlineUrisList); }
@Test public void shouldPassAirlineNativeUriToTravelAgency() throws ContextNotSentException { ContextSender sender = mock(ContextSender.class); ContextSenderFactory.testing = true; ContextSenderFactory.senderForTesting = sender; ContextCaster caster = new ContextCaster(models.getChoreography()); caster.cast(); List<String> expectedAirlineUrisList = new ArrayList<String>(); expectedAirlineUrisList.add(AIRLINE_URI); verify(sender).sendContext(TRAVEL_AGENCY_URI, AIRLINE, AIRLINE, expectedAirlineUrisList); }
@Test public void shouldCastContextToSampleChor() throws ContextNotSentException { SampleChoreography sample = new SampleChoreography(); Choreography chor = sample.getChoreography(); ContextSender sender = mock(ContextSender.class); ContextSenderFactory.testing = true; ContextSenderFactory.senderForTesting = sender; ContextCaster caster = new ContextCaster(chor); caster.cast(); for (DeployableServiceSpec spec : chor.getChoreographySpec().getDeployableServiceSpecs()) { String consumerUri = sample.getUri(spec.getName()); if (spec.getDependencies() != null) { for (ServiceDependency dep : spec.getDependencies()) { String providerName = dep.getServiceSpecName(); String providerUri = sample.getUri(providerName); verify(sender).sendContext(consumerUri, sample.getRole(), providerName, Collections.singletonList(providerUri)); } } } }