@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());
}