CookbookParseResult { public List<CookbookParseResult> getListOfConfigsInOwnParseresult() { List<CookbookParseResult> parseResultsList = new ArrayList<>(); List<ChefCookbookConfiguration> cookbookConfigs = this.getAllConfigsAsList(); if (cookbookConfigs.size() > 0) { for (int i = 0; i < cookbookConfigs.size(); i++) { CookbookParseResult parseResult = new CookbookParseResult(this); parseResult.clearConfigurations(); parseResult.putCookbookConfig(cookbookConfigs.get(i)); parseResultsList.add(parseResult); } } else { CookbookParseResult parseResult = new CookbookParseResult(this); parseResultsList.add(parseResult); } return parseResultsList; } CookbookParseResult(String cookbookName);  CookbookParseResult(CookbookParseResult cookbookParseResult); String getCookbookName(); void setCookbookName(String cookbookName); boolean isInDependentRecipe(); void setInDependentRecipe(boolean inDependentRecipe); String getAttribute(String key); void putAttribute(String key, String value); HashMap<String, String> getAttributes(); HashMap<String, HashMap<String, ChefCookbookConfiguration>> getCookbookConfigs(); HashMap<String, ChefCookbookConfiguration> getCookbookConfigsByPlatform(String platformName); void setCookbookConfigs(HashMap<String, HashMap<String, ChefCookbookConfiguration>> cookbookConfigs); void putCookbookConfig(ChefCookbookConfiguration cookbookConfiguration); void clear(); void clearAttributes(); void clearConfigurations(); void putCookbookConfigsAsList(List<ChefCookbookConfiguration> cookbookConfigList); List<ChefCookbookConfiguration> getAllConfigsAsList(); void addNotatedPackage(ChefPackage chefPackage); ArrayList<ChefPackage> getNotatedPackages(); void clearNotatedPackage(); void addAttributeToAllConfigs(String name, List value); void replaceCookbookConfigs(List<ChefCookbookConfiguration> cookbookConfigList); List<CookbookParseResult> getListOfConfigsInOwnParseresult(); int getNumOfCookbookConfigs(); String getCookbookPath(); void setCookbookPath(String cookbookPath); void prepareForDependencie(String cookbookName); boolean isInRecursiveTransformation(); void setInRecursiveTransformation(boolean inRecursiveTransformation);  }
@Test public void getListOfConfigsInOwnParseresult() { CookbookParseResult parseResult = new CookbookParseResult("test"); List<ChefCookbookConfiguration> configList = new LinkedList<>(); ChefCookbookConfiguration chefConfig = new ChefCookbookConfiguration(); ChefCookbookConfiguration chefConfig1 = new ChefCookbookConfiguration(); ChefCookbookConfiguration chefConfig2 = new ChefCookbookConfiguration(); chefConfig.setName("config1"); chefConfig1.setName("config2"); chefConfig2.setName("config3"); chefConfig.setSupports(new Platform("ubuntu", "16.04")); chefConfig1.setSupports(new Platform("ubuntu", "18.04")); chefConfig2.setSupports(new Platform("windows", "18.04")); configList.add(chefConfig); configList.add(chefConfig1); configList.add(chefConfig2); parseResult.putCookbookConfigsAsList(configList); List<CookbookParseResult> parseResultList = parseResult.getListOfConfigsInOwnParseresult(); assertEquals(3, parseResultList.size()); assertEquals("test", parseResultList.get(0).getCookbookName()); assertEquals("test", parseResultList.get(1).getCookbookName()); assertEquals("test", parseResultList.get(2).getCookbookName()); }