CookbookUtils { public static boolean isEnumType(Cookbook cookbook, String name) { return cookbook.getEnums().stream().anyMatch(e -> e.getName().equals(name)); }  static boolean isPrimitiveType(String type); static boolean isFlagType(String flag); static boolean isKnownType(Cookbook cookbook, String type); static boolean isEnumType(Cookbook cookbook, String name); static boolean enumHasValue(Cookbook cookbook, String enumName, String value); static boolean isPrimitiveType(Type type); static boolean isNonPrimitive(String type, Cookbook cookbook); static Set<String> getNonPrimitiveTypes(Ingredient ingredient, Cookbook cookbook); static String getBaseType(String type, Cookbook cookbook); static ParamType parseType(String type, Cookbook cookbook);  }
@Test public void testIsEnumType_enumType() { List<Enum> enums = new ArrayList<>(); List<String> enumValues = new ArrayList<>(); enumValues.add("A"); enumValues.add("B"); enums.add(new Enum("MyEnum", enumValues)); Cookbook cookbook = new Cookbook("test", new ArrayList<>(), enums); assertTrue(CookbookUtils.isEnumType(cookbook, "MyEnum")); }
@Test public void testIsEnumType_unknownType() { Cookbook cookbook = new Cookbook("test", new ArrayList<>(), new ArrayList<>()); assertFalse(CookbookUtils.isEnumType(cookbook, "foo")); }