diff --git a/recipe-example-api/src/main/conjure/recipe-example-api.yml b/recipe-example-api/src/main/conjure/recipe-example-api.yml index 58d7109e..397a30e9 100644 --- a/recipe-example-api/src/main/conjure/recipe-example-api.yml +++ b/recipe-example-api/src/main/conjure/recipe-example-api.yml @@ -5,7 +5,7 @@ types: Temperature: fields: degree: double - unit: string + unit: TemperatureUnit Ingredient: alias: string @@ -29,6 +29,11 @@ types: name: RecipeName steps: list + TemperatureUnit: + values: + - FAHRENHEIT + - CELCIUS + errors: RecipeNotFound: namespace: Recipe diff --git a/recipe-example-server/src/test/java/com/palantir/conjure/examples/RecipeBookApplicationTest.java b/recipe-example-server/src/test/java/com/palantir/conjure/examples/RecipeBookApplicationTest.java index 10bf63e6..6e45122f 100644 --- a/recipe-example-server/src/test/java/com/palantir/conjure/examples/RecipeBookApplicationTest.java +++ b/recipe-example-server/src/test/java/com/palantir/conjure/examples/RecipeBookApplicationTest.java @@ -19,10 +19,17 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.assertEquals; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableSet; import com.google.common.io.Resources; +import com.palantir.conjure.examples.recipe.api.BakeStep; +import com.palantir.conjure.examples.recipe.api.Ingredient; import com.palantir.conjure.examples.recipe.api.Recipe; import com.palantir.conjure.examples.recipe.api.RecipeBookService; import com.palantir.conjure.examples.recipe.api.RecipeName; +import com.palantir.conjure.examples.recipe.api.RecipeStep; +import com.palantir.conjure.examples.recipe.api.Temperature; +import com.palantir.conjure.examples.recipe.api.TemperatureUnit; import feign.Client; import feign.Feign; import feign.FeignException; @@ -72,4 +79,22 @@ public void getRecipe() { Set recipes = client.getAllRecipes(); assertEquals(RULE.getConfiguration().getRecipes(), recipes); } + + @Test + public void getRecipeWithBake() { + RecipeName recipeName = RecipeName.of("baked potatoes"); + Recipe recipe = client.getRecipe(recipeName); + Recipe expectedRecipe = Recipe.of(recipeName, ImmutableList.of( + RecipeStep.mix(ImmutableSet.of( + Ingredient.of("rub oil all over the potatoes"), + Ingredient.of("Rub salt all over the potatoes"))), + RecipeStep.bake(BakeStep.builder() + .temperature(Temperature.builder() + .degree(220) + .unit(TemperatureUnit.CELCIUS) + .build()) + .durationInSeconds(2700) + .build()))); + assertEquals(expectedRecipe, recipe); + } } diff --git a/recipe-example-server/src/test/resources/test.yml b/recipe-example-server/src/test/resources/test.yml index c198256f..9cf6f258 100644 --- a/recipe-example-server/src/test/resources/test.yml +++ b/recipe-example-server/src/test/resources/test.yml @@ -15,7 +15,7 @@ recipes: bake: temperature: degree: 230 - unit: "C" + unit: "CELCIUS" durationInSeconds: 1200 - name: "baked potatoes" steps: @@ -25,5 +25,5 @@ recipes: bake: temperature: degree: 220 - unit: "C" + unit: "CELCIUS" durationInSeconds: 2700 diff --git a/recipe-example-server/var/conf/recipes.yml b/recipe-example-server/var/conf/recipes.yml index d975a671..93cb1903 100644 --- a/recipe-example-server/var/conf/recipes.yml +++ b/recipe-example-server/var/conf/recipes.yml @@ -20,7 +20,7 @@ recipes: bake: temperature: degree: 230 - unit: "C" + unit: "FAHRENHEIT" durationInSeconds: 1200 - name: "roasted broccoli with garlic" steps: @@ -32,7 +32,7 @@ recipes: bake: temperature: degree: 230 - unit: "C" + unit: "CELCIUS" durationInSeconds: 1200 - name: "baked potatoes" steps: @@ -42,6 +42,6 @@ recipes: bake: temperature: degree: 220 - unit: "C" + unit: "CELCIUS" durationInSeconds: 2700