Improved comments
This commit is contained in:
parent
443908e7b6
commit
5ef14ae5ee
1 changed files with 7 additions and 0 deletions
|
|
@ -69,6 +69,7 @@ class ServerUtilsMockTest {
|
||||||
String inputJson = objectMapper.writeValueAsString(input);
|
String inputJson = objectMapper.writeValueAsString(input);
|
||||||
|
|
||||||
// Setup fake endpoint that returns empty list for getRecipes.
|
// Setup fake endpoint that returns empty list for getRecipes.
|
||||||
|
// urlPathEqualTo, because it ignores query params.
|
||||||
stubFor(get(urlPathEqualTo("/api/recipes")).willReturn(okJson("[]")));
|
stubFor(get(urlPathEqualTo("/api/recipes")).willReturn(okJson("[]")));
|
||||||
|
|
||||||
// Setup fake endpoint that returns the input recipe when creating new recipe.
|
// Setup fake endpoint that returns the input recipe when creating new recipe.
|
||||||
|
|
@ -105,6 +106,7 @@ class ServerUtilsMockTest {
|
||||||
String recipesJson = objectMapper.writeValueAsString(recipes);
|
String recipesJson = objectMapper.writeValueAsString(recipes);
|
||||||
|
|
||||||
// Setup fake endpoint that returns list with 1 recipe in it.
|
// Setup fake endpoint that returns list with 1 recipe in it.
|
||||||
|
// urlPathEqualTo, because it ignores query params.
|
||||||
stubFor(get(urlPathEqualTo("/api/recipes")).willReturn(okJson(recipesJson)));
|
stubFor(get(urlPathEqualTo("/api/recipes")).willReturn(okJson(recipesJson)));
|
||||||
|
|
||||||
// Our input to add.
|
// Our input to add.
|
||||||
|
|
@ -158,6 +160,7 @@ class ServerUtilsMockTest {
|
||||||
String recipesJson = objectMapper.writeValueAsString(recipes);
|
String recipesJson = objectMapper.writeValueAsString(recipes);
|
||||||
|
|
||||||
// Setup fake endpoint that returns list with 1 recipe in it.
|
// Setup fake endpoint that returns list with 1 recipe in it.
|
||||||
|
// urlPathEqualTo, because it ignores query params.
|
||||||
stubFor(get(urlPathEqualTo("/api/recipes")).willReturn(okJson(recipesJson)));
|
stubFor(get(urlPathEqualTo("/api/recipes")).willReturn(okJson(recipesJson)));
|
||||||
|
|
||||||
// Our input to add.
|
// Our input to add.
|
||||||
|
|
@ -189,6 +192,7 @@ class ServerUtilsMockTest {
|
||||||
inputRecipe.setName(pre.getName()); // Reset name back to Steak without the (1)
|
inputRecipe.setName(pre.getName()); // Reset name back to Steak without the (1)
|
||||||
|
|
||||||
// Setup fake endpoint that returns list with 2 recipes in it.
|
// Setup fake endpoint that returns list with 2 recipes in it.
|
||||||
|
// urlPathEqualTo, because it ignores query params.
|
||||||
stubFor(get(urlPathEqualTo("/api/recipes")).willReturn(okJson(recipesJson)));
|
stubFor(get(urlPathEqualTo("/api/recipes")).willReturn(okJson(recipesJson)));
|
||||||
|
|
||||||
serverUtils.addRecipe(inputRecipe);
|
serverUtils.addRecipe(inputRecipe);
|
||||||
|
|
@ -234,6 +238,7 @@ class ServerUtilsMockTest {
|
||||||
String verifyJson = objectMapper.writeValueAsString(generatedRecipe);
|
String verifyJson = objectMapper.writeValueAsString(generatedRecipe);
|
||||||
|
|
||||||
// Setup fake endpoint that returns empty list for getRecipes.
|
// Setup fake endpoint that returns empty list for getRecipes.
|
||||||
|
// urlPathEqualTo, because it ignores query params.
|
||||||
stubFor(get(urlPathEqualTo("/api/recipes")).willReturn(okJson("[]")));
|
stubFor(get(urlPathEqualTo("/api/recipes")).willReturn(okJson("[]")));
|
||||||
|
|
||||||
// Setup fake endpoint that returns the input recipe when creating new recipe.
|
// Setup fake endpoint that returns the input recipe when creating new recipe.
|
||||||
|
|
@ -250,6 +255,7 @@ class ServerUtilsMockTest {
|
||||||
@Test
|
@Test
|
||||||
void findIdNotFoundTest() throws IOException, InterruptedException {
|
void findIdNotFoundTest() throws IOException, InterruptedException {
|
||||||
// Setup fake endpoint that returns empty list for getRecipes.
|
// Setup fake endpoint that returns empty list for getRecipes.
|
||||||
|
// urlPathEqualTo, because it ignores query params.
|
||||||
stubFor(get(urlPathEqualTo("/api/recipes")).willReturn(okJson("[]")));
|
stubFor(get(urlPathEqualTo("/api/recipes")).willReturn(okJson("[]")));
|
||||||
|
|
||||||
assertThrows(IOException.class, () -> serverUtils.findId(1L));
|
assertThrows(IOException.class, () -> serverUtils.findId(1L));
|
||||||
|
|
@ -267,6 +273,7 @@ class ServerUtilsMockTest {
|
||||||
String recipeJson = objectMapper.writeValueAsString(recipe);
|
String recipeJson = objectMapper.writeValueAsString(recipe);
|
||||||
|
|
||||||
// Setup fake endpoint that returns the recipe by id.
|
// Setup fake endpoint that returns the recipe by id.
|
||||||
|
// urlPathEqualTo, because it ignores query params.
|
||||||
stubFor(get(urlPathEqualTo("/api/recipe/"+recipe.getId())).willReturn(okJson(recipeJson)));
|
stubFor(get(urlPathEqualTo("/api/recipe/"+recipe.getId())).willReturn(okJson(recipeJson)));
|
||||||
|
|
||||||
Recipe found = serverUtils.findId(recipe.getId());
|
Recipe found = serverUtils.findId(recipe.getId());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue