Skip to content

Commit 51d92f9

Browse files
author
Mohamed
committed
Fix: Changed json to be correct formating
1 parent 99315c6 commit 51d92f9

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

lesson_16/api/api_app/src/test/java/com/codedifferently/lesson16/web/PatronControllerTest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ void testController_getsAllPatrons() throws Exception {
5151
.perform(get("/patrons").contentType(MediaType.APPLICATION_JSON))
5252
.andExpect(status().isOk())
5353
.andExpect(jsonPath("$.patrons").isArray())
54-
.andExpect(jsonPath("$.patrons.length()").value(4));
54+
.andExpect(jsonPath("$.patrons.length()").value(5));
5555
}
5656

5757
@Test
@@ -78,18 +78,18 @@ void testController_reportsBadRequestOnAddPatron() throws Exception {
7878
void testController_addsPatron() throws Exception {
7979
String json =
8080
"""
81-
{
82-
"patron":{
83-
"name": "John Book",
84-
"email": "[email protected]",
85-
}
86-
}
87-
""";
81+
{
82+
"patron":{
83+
"name": "John Book",
84+
"email": "[email protected]"
85+
}
86+
}
87+
""";
8888

8989
mockMvc
9090
.perform(post("/patrons").contentType(MediaType.APPLICATION_JSON).content(json))
9191
.andExpect(status().isOk())
92-
.andExpect(jsonPath("$.patrons.name").value("John Book"));
92+
.andExpect(jsonPath("$.patron.name").value("John Book"));
9393
}
9494

9595
@Test

0 commit comments

Comments
 (0)