test_class.declarator: loader
test_class.modifier: private
test_class.original_string: private CookbookLoader loader;
test_class.type: CookbookLoader
test_class.var_name: loader
test_class.file: recipe-generator/src/test/java/ca/derekcormier/recipe/cookbook/CookbookLoaderTest.java
test_class.identifier: CookbookLoaderTest
test_case.body: @Test
    public void testLoad_sampleIngredient() {
      String ingredients =
          String.join(
              "\n",
              "domain: 'test'",
              "ingredients:",
              "  - name: 'fooIngredient'",
              "    constants: {KEY_A: 'KEY_A', KEY_B: 'KEY_B'}",
              "    keyed: true",
              "    required:",
              "      - name: 'requiredField'",
              "        type: 'string'",
              "        default: 'foobar'",
              "    initializers:",
              "      - params: []",
              "      - params:",
              "        - 'requiredField'",
              "    optionals:",
              "      - name: 'optionalField'",
              "        type: 'boolean'",
              "      - name: 'repeatableOptionalField'",
              "        type: 'string'",
              "        repeatable: true",
              "      - name: 'compoundOptionalField'",
              "        params:",
              "          - name: 'compoundOptionalParam1'",
              "            type: 'string'",
              "          - name: 'compoundOptionalParam2'",
              "            type: 'boolean'",
              "      - name: 'repeatableCompoundOptionalField'",
              "        params:",
              "          - name: 'compoundOptionalParam1'",
              "            type: 'string'",
              "          - name: 'compoundOptionalParam2'",
              "            type: 'string'",
              "        repeatable: true");
  
      Cookbook cookbook = loader.load(toStream(ingredients));
  
      assertEquals(1, cookbook.getIngredients().size());
      assertEquals("fooIngredient", cookbook.getIngredients().get(0).getName());
      assertEquals(2, cookbook.getIngredients().get(0).getConstants().size());
      assertEquals("KEY_A", cookbook.getIngredients().get(0).getConstants().get("KEY_A"));
      assertEquals("KEY_B", cookbook.getIngredients().get(0).getConstants().get("KEY_B"));
      assertTrue(cookbook.getIngredients().get(0).isKeyed());
      assertEquals(1, cookbook.getIngredients().get(0).getRequired().size());
      assertEquals("requiredField", cookbook.getIngredients().get(0).getRequired().get(0).getName());
      assertEquals("foobar", cookbook.getIngredients().get(0).getRequired().get(0).getDefault());
      assertEquals("string", cookbook.getIngredients().get(0).getRequired().get(0).getType());
      assertEquals(2, cookbook.getIngredients().get(0).getInitializers().size());
      assertEquals(0, cookbook.getIngredients().get(0).getInitializers().get(0).getParams().size());
      assertEquals(1, cookbook.getIngredients().get(0).getInitializers().get(1).getParams().size());
      assertEquals(
          "requiredField",
          cookbook.getIngredients().get(0).getInitializers().get(1).getParams().get(0));
      assertEquals(4, cookbook.getIngredients().get(0).getOptionals().size());
      assertEquals("optionalField", cookbook.getIngredients().get(0).getOptionals().get(0).getName());
      assertEquals("boolean", cookbook.getIngredients().get(0).getOptionals().get(0).getType());
      assertFalse(cookbook.getIngredients().get(0).getOptionals().get(0).isRepeatable());
      assertEquals(
          "repeatableOptionalField",
          cookbook.getIngredients().get(0).getOptionals().get(1).getName());
      assertEquals("string", cookbook.getIngredients().get(0).getOptionals().get(1).getType());
      assertTrue(cookbook.getIngredients().get(0).getOptionals().get(1).isRepeatable());
      assertEquals(
          "compoundOptionalField", cookbook.getIngredients().get(0).getOptionals().get(2).getName());
      assertEquals(2, cookbook.getIngredients().get(0).getOptionals().get(2).getParams().size());
      assertEquals(
          "compoundOptionalParam1",
          cookbook.getIngredients().get(0).getOptionals().get(2).getParams().get(0).getName());
      assertEquals(
          "string",
          cookbook.getIngredients().get(0).getOptionals().get(2).getParams().get(0).getType());
      assertEquals(
          "compoundOptionalParam2",
          cookbook.getIngredients().get(0).getOptionals().get(2).getParams().get(1).getName());
      assertEquals(
          "boolean",
          cookbook.getIngredients().get(0).getOptionals().get(2).getParams().get(1).getType());
      assertFalse(cookbook.getIngredients().get(0).getOptionals().get(2).isRepeatable());
      assertEquals(
          "repeatableCompoundOptionalField",
          cookbook.getIngredients().get(0).getOptionals().get(3).getName());
      assertEquals(2, cookbook.getIngredients().get(0).getOptionals().get(3).getParams().size());
      assertEquals(
          "compoundOptionalParam1",
          cookbook.getIngredients().get(0).getOptionals().get(3).getParams().get(0).getName());
      assertEquals(
          "string",
          cookbook.getIngredients().get(0).getOptionals().get(3).getParams().get(0).getType());
      assertEquals(
          "compoundOptionalParam2",
          cookbook.getIngredients().get(0).getOptionals().get(3).getParams().get(1).getName());
      assertEquals(
          "string",
          cookbook.getIngredients().get(0).getOptionals().get(3).getParams().get(1).getType());
      assertTrue(cookbook.getIngredients().get(0).getOptionals().get(3).isRepeatable());
    }
test_case.class_method_signature: CookbookLoaderTest.testLoad_sampleIngredient()
test_case.full_signature: @Test public void testLoad_sampleIngredient()
test_case.identifier: testLoad_sampleIngredient
test_case.invocations: join load toStream assertEquals size getIngredients assertEquals getName get getIngredients assertEquals size getConstants get getIngredients assertEquals get getConstants get getIngredients assertEquals get getConstants get getIngredients assertTrue isKeyed get getIngredients assertEquals size getRequired get getIngredients assertEquals getName get getRequired get getIngredients assertEquals getDefault get getRequired get getIngredients assertEquals getType get getRequired get getIngredients assertEquals size getInitializers get getIngredients assertEquals size getParams get getInitializers get getIngredients assertEquals size getParams get getInitializers get getIngredients assertEquals get getParams get getInitializers get getIngredients assertEquals size getOptionals get getIngredients assertEquals getName get getOptionals get getIngredients assertEquals getType get getOptionals get getIngredients assertFalse isRepeatable get getOptionals get getIngredients assertEquals getName get getOptionals get getIngredients assertEquals getType get getOptionals get getIngredients assertTrue isRepeatable get getOptionals get getIngredients assertEquals getName get getOptionals get getIngredients assertEquals size getParams get getOptionals get getIngredients assertEquals getName get getParams get getOptionals get getIngredients assertEquals getType get getParams get getOptionals get getIngredients assertEquals getName get getParams get getOptionals get getIngredients assertEquals getType get getParams get getOptionals get getIngredients assertFalse isRepeatable get getOptionals get getIngredients assertEquals getName get getOptionals get getIngredients assertEquals size getParams get getOptionals get getIngredients assertEquals getName get getParams get getOptionals get getIngredients assertEquals getType get getParams get getOptionals get getIngredients assertEquals getName get getParams get getOptionals get getIngredients assertEquals getType get getParams get getOptionals get getIngredients assertTrue isRepeatable get getOptionals get getIngredients
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testLoad_sampleIngredient()
focal_class.file: recipe-generator/src/main/java/ca/derekcormier/recipe/cookbook/CookbookLoader.java
focal_class.identifier: CookbookLoader
focal_class.class_method_signature: CookbookLoader.load(InputStream ingredients)
focal_class.full_signature: public Cookbook load(InputStream ingredients)
focal_class.identifier: load
focal_class.modifiers: public
focal_class.parameters: (InputStream ingredients)
focal_class.return: Cookbook
focal_class.signature: Cookbook load(InputStream ingredients)
focal_class.class_method_signature: CookbookLoader.validate(Cookbook cookbook)
focal_class.full_signature: private void validate(Cookbook cookbook)
focal_class.identifier: validate
focal_class.modifiers: private
focal_class.parameters: (Cookbook cookbook)
focal_class.return: void
focal_class.signature: void validate(Cookbook cookbook)
focal_class.class_method_signature: CookbookLoader.validateDomain(Cookbook cookbook)
focal_class.full_signature: private void validateDomain(Cookbook cookbook)
focal_class.identifier: validateDomain
focal_class.modifiers: private
focal_class.parameters: (Cookbook cookbook)
focal_class.return: void
focal_class.signature: void validateDomain(Cookbook cookbook)
focal_class.class_method_signature: CookbookLoader.validateIngredients(Cookbook cookbook)
focal_class.full_signature: private void validateIngredients(Cookbook cookbook)
focal_class.identifier: validateIngredients
focal_class.modifiers: private
focal_class.parameters: (Cookbook cookbook)
focal_class.return: void
focal_class.signature: void validateIngredients(Cookbook cookbook)
focal_class.class_method_signature: CookbookLoader.validateEnums(Cookbook cookbook)
focal_class.full_signature: private void validateEnums(Cookbook cookbook)
focal_class.identifier: validateEnums
focal_class.modifiers: private
focal_class.parameters: (Cookbook cookbook)
focal_class.return: void
focal_class.signature: void validateEnums(Cookbook cookbook)
focal_class.class_method_signature: CookbookLoader.validateInitializersContainRequiredFields(Cookbook cookbook)
focal_class.full_signature: private void validateInitializersContainRequiredFields(Cookbook cookbook)
focal_class.identifier: validateInitializersContainRequiredFields
focal_class.modifiers: private
focal_class.parameters: (Cookbook cookbook)
focal_class.return: void
focal_class.signature: void validateInitializersContainRequiredFields(Cookbook cookbook)
focal_class.class_method_signature: CookbookLoader.validateNoDuplicateIngredientNames(Cookbook cookbook)
focal_class.full_signature: private void validateNoDuplicateIngredientNames(Cookbook cookbook)
focal_class.identifier: validateNoDuplicateIngredientNames
focal_class.modifiers: private
focal_class.parameters: (Cookbook cookbook)
focal_class.return: void
focal_class.signature: void validateNoDuplicateIngredientNames(Cookbook cookbook)
focal_class.class_method_signature: CookbookLoader.validateParamTypes(Cookbook cookbook)
focal_class.full_signature: private void validateParamTypes(Cookbook cookbook)
focal_class.identifier: validateParamTypes
focal_class.modifiers: private
focal_class.parameters: (Cookbook cookbook)
focal_class.return: void
focal_class.signature: void validateParamTypes(Cookbook cookbook)
focal_class.class_method_signature: CookbookLoader.validateNoDuplicateFieldNames(Cookbook cookbook)
focal_class.full_signature: private void validateNoDuplicateFieldNames(Cookbook cookbook)
focal_class.identifier: validateNoDuplicateFieldNames
focal_class.modifiers: private
focal_class.parameters: (Cookbook cookbook)
focal_class.return: void
focal_class.signature: void validateNoDuplicateFieldNames(Cookbook cookbook)
focal_class.class_method_signature: CookbookLoader.validateInitializerSignaturesUnique(Cookbook cookbook)
focal_class.full_signature: private void validateInitializerSignaturesUnique(Cookbook cookbook)
focal_class.identifier: validateInitializerSignaturesUnique
focal_class.modifiers: private
focal_class.parameters: (Cookbook cookbook)
focal_class.return: void
focal_class.signature: void validateInitializerSignaturesUnique(Cookbook cookbook)
focal_class.class_method_signature: CookbookLoader.validateRequiredHaveDefaultOrAppearInAllInitializers(Cookbook cookbook)
focal_class.full_signature: private void validateRequiredHaveDefaultOrAppearInAllInitializers(Cookbook cookbook)
focal_class.identifier: validateRequiredHaveDefaultOrAppearInAllInitializers
focal_class.modifiers: private
focal_class.parameters: (Cookbook cookbook)
focal_class.return: void
focal_class.signature: void validateRequiredHaveDefaultOrAppearInAllInitializers(Cookbook cookbook)
focal_class.class_method_signature: CookbookLoader.validateVaragParamsAppearLastInParamLists(Cookbook cookbook)
focal_class.full_signature: private void validateVaragParamsAppearLastInParamLists(Cookbook cookbook)
focal_class.identifier: validateVaragParamsAppearLastInParamLists
focal_class.modifiers: private
focal_class.parameters: (Cookbook cookbook)
focal_class.return: void
focal_class.signature: void validateVaragParamsAppearLastInParamLists(Cookbook cookbook)
focal_class.class_method_signature: CookbookLoader.validateConstantNames(Cookbook cookbook)
focal_class.full_signature: private void validateConstantNames(Cookbook cookbook)
focal_class.identifier: validateConstantNames
focal_class.modifiers: private
focal_class.parameters: (Cookbook cookbook)
focal_class.return: void
focal_class.signature: void validateConstantNames(Cookbook cookbook)
focal_class.class_method_signature: CookbookLoader.validateNoDuplicateConstantNames(Cookbook cookbook)
focal_class.full_signature: private void validateNoDuplicateConstantNames(Cookbook cookbook)
focal_class.identifier: validateNoDuplicateConstantNames
focal_class.modifiers: private
focal_class.parameters: (Cookbook cookbook)
focal_class.return: void
focal_class.signature: void validateNoDuplicateConstantNames(Cookbook cookbook)
focal_class.class_method_signature: CookbookLoader.validateDefaultKey(Cookbook cookbook)
focal_class.full_signature: private void validateDefaultKey(Cookbook cookbook)
focal_class.identifier: validateDefaultKey
focal_class.modifiers: private
focal_class.parameters: (Cookbook cookbook)
focal_class.return: void
focal_class.signature: void validateDefaultKey(Cookbook cookbook)
focal_class.class_method_signature: CookbookLoader.validateNoDuplicateEnumNames(Cookbook cookbook)
focal_class.full_signature: private void validateNoDuplicateEnumNames(Cookbook cookbook)
focal_class.identifier: validateNoDuplicateEnumNames
focal_class.modifiers: private
focal_class.parameters: (Cookbook cookbook)
focal_class.return: void
focal_class.signature: void validateNoDuplicateEnumNames(Cookbook cookbook)
focal_class.class_method_signature: CookbookLoader.validateNoEmptyEnumValues(Cookbook cookbook)
focal_class.full_signature: private void validateNoEmptyEnumValues(Cookbook cookbook)
focal_class.identifier: validateNoEmptyEnumValues
focal_class.modifiers: private
focal_class.parameters: (Cookbook cookbook)
focal_class.return: void
focal_class.signature: void validateNoEmptyEnumValues(Cookbook cookbook)
focal_class.class_method_signature: CookbookLoader.validateNoDuplicateEnumValues(Cookbook cookbook)
focal_class.full_signature: private void validateNoDuplicateEnumValues(Cookbook cookbook)
focal_class.identifier: validateNoDuplicateEnumValues
focal_class.modifiers: private
focal_class.parameters: (Cookbook cookbook)
focal_class.return: void
focal_class.signature: void validateNoDuplicateEnumValues(Cookbook cookbook)
focal_method.body: public Cookbook load(InputStream ingredients) {
      ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
      Cookbook cookbook = null;
      try {
        cookbook = mapper.readValue(ingredients, Cookbook.class);
      } catch (IOException e) {
        throw new RuntimeException("could not load recipe cookbook from input stream", e);
      }
      validate(cookbook);
      return cookbook;
    }
focal_method.class_method_signature: CookbookLoader.load(InputStream ingredients)
focal_method.full_signature: public Cookbook load(InputStream ingredients)
focal_method.identifier: load
focal_method.invocations: readValue validate
focal_method.modifiers: public
focal_method.parameters: (InputStream ingredients)
focal_method.return: Cookbook
focal_method.signature: Cookbook load(InputStream ingredients)