### Question:
RouteScanner implements Scanner<SwitchYardModel> { @Override public ScannerOutput<SwitchYardModel> scan(ScannerInput<SwitchYardModel> input) throws IOException { SwitchYardNamespace switchyardNamespace = input.getSwitchyardNamespace(); SwitchYardModel switchyardModel = new V1SwitchYardModel(switchyardNamespace.uri()); CompositeModel compositeModel = new V1CompositeModel(); compositeModel.setName(input.getCompositeName()); CamelNamespace camelNamespace = CamelNamespace.DEFAULT; for (CamelNamespace value : CamelNamespace.values()) { if (value.versionMatches(switchyardNamespace)) { camelNamespace = value; break; } } List<Class<?>> routeClasses = scanForRoutes(input.getURLs()); for (Class<?> routeClass : routeClasses) { ComponentModel componentModel = new V1ComponentModel(); componentModel.setName(routeClass.getSimpleName()); CamelComponentImplementationModel camelModel = new V1CamelImplementationModel(camelNamespace.uri()); camelModel.setJavaClass(routeClass.getName()); componentModel.setImplementation(camelModel); compositeModel.addComponent(componentModel); ComponentServiceModel serviceModel = new V1ComponentServiceModel(switchyardNamespace.uri()); InterfaceModel csiModel = new V1InterfaceModel(InterfaceModel.JAVA); Class<?> serviceInterface = routeClass.getAnnotation(Route.class).value(); serviceModel.setName(getServiceName(routeClass)); csiModel.setInterface(serviceInterface.getName()); serviceModel.setInterface(csiModel); componentModel.addService(serviceModel); } if (!compositeModel.getModelChildren().isEmpty()) { switchyardModel.setComposite(compositeModel); } return new ScannerOutput<SwitchYardModel>().setModel(switchyardModel); }  @Override ScannerOutput<SwitchYardModel> scan(ScannerInput<SwitchYardModel> input);  }### Answer:
@Test public void componentImplementationCreated() throws Exception { scan(new URL(new File("./target/test-classes").toURI().toURL(), "#org/switchyard/component/camel/scanner")); List<ComponentModel> components = _scannedModel.getComposite().getComponents(); for(ComponentModel component : components) { System.out.println("RouteScanner found component: " + component.getName()); assertEquals(SingleRouteService.class.getSimpleName(), component.getName()); assertTrue(component.getServices().size() == 1); ComponentImplementationModel implementation = component.getImplementation(); assertTrue(implementation instanceof CamelComponentImplementationModel); checkCamelImplementation((CamelComponentImplementationModel)implementation); } }
@Test public void testEmptyScan() throws Exception { scan(); assertNull("Composite element should not be created if no components were found.", _scannedModel.getComposite()); }