@Test void testGetInstance() { final int maxAliases = 5; ApplicationConfiguration applicationConfiguration = Mockito.mock(ApplicationConfiguration.class); Mockito.when(applicationConfiguration.getSnakeyamlMaxAliasesForCollections()) .thenReturn(maxAliases); DescriptorParserFacadeFactory descriptorParserFacadeFactory = new DescriptorParserFacadeFactory(applicationConfiguration); DescriptorParserFacade instance = descriptorParserFacadeFactory.getInstance(); InputStream mtadYaml = getClass().getResourceAsStream("billion-laughs.mtad.yaml"); Assertions.assertThrows(ParsingException.class, () -> instance.parseDeploymentDescriptor(mtadYaml)); }
public DescriptorParserFacade getInstance() { LoaderOptions loaderOptions = new LoaderOptions(); loaderOptions.setMaxAliasesForCollections(applicationConfiguration.getSnakeyamlMaxAliasesForCollections()); YamlParser yamlParser = new YamlParser(loaderOptions); return new DescriptorParserFacade(yamlParser); }
DescriptorParserFacadeFactory { public DescriptorParserFacade getInstance() { LoaderOptions loaderOptions = new LoaderOptions(); loaderOptions.setMaxAliasesForCollections(applicationConfiguration.getSnakeyamlMaxAliasesForCollections()); YamlParser yamlParser = new YamlParser(loaderOptions); return new DescriptorParserFacade(yamlParser); } }
DescriptorParserFacadeFactory { public DescriptorParserFacade getInstance() { LoaderOptions loaderOptions = new LoaderOptions(); loaderOptions.setMaxAliasesForCollections(applicationConfiguration.getSnakeyamlMaxAliasesForCollections()); YamlParser yamlParser = new YamlParser(loaderOptions); return new DescriptorParserFacade(yamlParser); } @Inject  DescriptorParserFacadeFactory(ApplicationConfiguration applicationConfiguration); }
DescriptorParserFacadeFactory { public DescriptorParserFacade getInstance() { LoaderOptions loaderOptions = new LoaderOptions(); loaderOptions.setMaxAliasesForCollections(applicationConfiguration.getSnakeyamlMaxAliasesForCollections()); YamlParser yamlParser = new YamlParser(loaderOptions); return new DescriptorParserFacade(yamlParser); } @Inject  DescriptorParserFacadeFactory(ApplicationConfiguration applicationConfiguration); DescriptorParserFacade getInstance(); }
DescriptorParserFacadeFactory { public DescriptorParserFacade getInstance() { LoaderOptions loaderOptions = new LoaderOptions(); loaderOptions.setMaxAliasesForCollections(applicationConfiguration.getSnakeyamlMaxAliasesForCollections()); YamlParser yamlParser = new YamlParser(loaderOptions); return new DescriptorParserFacade(yamlParser); } @Inject  DescriptorParserFacadeFactory(ApplicationConfiguration applicationConfiguration); DescriptorParserFacade getInstance();  }