@Test public void testGetConsumers() throws JAXBException, IOException { Links links = new Links(); links.location = this.location; Link link = new Link(); link.callee = MockChangeDetector.PACKAGE_NAME + ".Callee"; link.calleeAction = "calleeAction()"; link.caller = MockChangeDetector.PACKAGE_NAME + ".Caller"; link.callerAction = "callerAction()"; links.link.add(link); links.link.add(link); File testFile = File.createTempFile("test-", ExtensionType.SANDBONI.type()); testFile.deleteOnExit(); JAXBContext jContext = JAXBContext.newInstance(Links.class); Marshaller marshaller = jContext.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); marshaller.marshal(links, new FileWriter(testFile)); ExplicitFinder explicitFinder = new ExplicitFinder(); Map<String, ThrowingBiConsumer<File, Context>> consumers = explicitFinder.getConsumers(); ThrowingBiConsumer<File, Context> consumer = consumers.get(ExtensionType.SANDBONI.type()); consumer.accept(testFile, context); Assert.assertTrue(context.getLinks().count() > 0); assertLinksExist(ExplicitFinder.toLink(context.getApplicationId(), link)); }
@Override protected Map<String, ThrowingBiConsumer<File, Context>> getConsumers() { HashMap<String, ThrowingBiConsumer<File, Context>> map = new HashMap<>(); map.put(ExtensionType.SANDBONI.type(), (file, context) -> { JAXBContext jContext = JAXBContext.newInstance(Links.class); Unmarshaller unmarshaller = jContext.createUnmarshaller(); Links links = (Links) unmarshaller.unmarshal(file); links.link.forEach(l -> context.addLink(toLink(context.getApplicationId(), l))); }); return map; }
ExplicitFinder extends FileTreeFinder { @Override protected Map<String, ThrowingBiConsumer<File, Context>> getConsumers() { HashMap<String, ThrowingBiConsumer<File, Context>> map = new HashMap<>(); map.put(ExtensionType.SANDBONI.type(), (file, context) -> { JAXBContext jContext = JAXBContext.newInstance(Links.class); Unmarshaller unmarshaller = jContext.createUnmarshaller(); Links links = (Links) unmarshaller.unmarshal(file); links.link.forEach(l -> context.addLink(toLink(context.getApplicationId(), l))); }); return map; } }
ExplicitFinder extends FileTreeFinder { @Override protected Map<String, ThrowingBiConsumer<File, Context>> getConsumers() { HashMap<String, ThrowingBiConsumer<File, Context>> map = new HashMap<>(); map.put(ExtensionType.SANDBONI.type(), (file, context) -> { JAXBContext jContext = JAXBContext.newInstance(Links.class); Unmarshaller unmarshaller = jContext.createUnmarshaller(); Links links = (Links) unmarshaller.unmarshal(file); links.link.forEach(l -> context.addLink(toLink(context.getApplicationId(), l))); }); return map; }  }
ExplicitFinder extends FileTreeFinder { @Override protected Map<String, ThrowingBiConsumer<File, Context>> getConsumers() { HashMap<String, ThrowingBiConsumer<File, Context>> map = new HashMap<>(); map.put(ExtensionType.SANDBONI.type(), (file, context) -> { JAXBContext jContext = JAXBContext.newInstance(Links.class); Unmarshaller unmarshaller = jContext.createUnmarshaller(); Links links = (Links) unmarshaller.unmarshal(file); links.link.forEach(l -> context.addLink(toLink(context.getApplicationId(), l))); }); return map; }   }
ExplicitFinder extends FileTreeFinder { @Override protected Map<String, ThrowingBiConsumer<File, Context>> getConsumers() { HashMap<String, ThrowingBiConsumer<File, Context>> map = new HashMap<>(); map.put(ExtensionType.SANDBONI.type(), (file, context) -> { JAXBContext jContext = JAXBContext.newInstance(Links.class); Unmarshaller unmarshaller = jContext.createUnmarshaller(); Links links = (Links) unmarshaller.unmarshal(file); links.link.forEach(l -> context.addLink(toLink(context.getApplicationId(), l))); }); return map; }    }