File tree Expand file tree Collapse file tree 1 file changed +5
-9
lines changed
lesson_16/api/api_app/src/test/java/com/codedifferently/lesson16/web Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ void testController_getsAllPatrons() throws Exception {
5454 .perform (get ("/patrons" ).contentType (MediaType .APPLICATION_JSON ))
5555 .andExpect (status ().isOk ())
5656 .andExpect (jsonPath ("$.patrons" ).isArray ())
57- .andExpect (jsonPath ("$.patrons.length()" ).value (5 ));
57+ .andExpect (jsonPath ("$.patrons.length()" ).value (4 ));
5858 }
5959
6060 @ Test
@@ -139,14 +139,10 @@ void testController_deletesPatron() throws Exception {
139139 }
140140
141141 UUID getGuestId (List <LibraryGuest > list ) {
142- if (list .get (0 ).getCheckedOutMediaItems ().size () == 0 ) {
143- return list .get (0 ).getId ();
144- } else if (list .get (1 ).getCheckedOutMediaItems ().size () == 0 ) {
145- return list .get (1 ).getId ();
146- } else if (list .get (2 ).getCheckedOutMediaItems ().size () == 0 ) {
147- return list .get (2 ).getId ();
148- } else if (list .get (3 ).getCheckedOutMediaItems ().size () == 0 ) {
149- return list .get (3 ).getId ();
142+ for (LibraryGuest guest : list ) {
143+ if (guest .getCheckedOutMediaItems ().size () == 0 ) {
144+ return guest .getId ();
145+ }
150146 }
151147 return list .get (4 ).getId ();
152148 }
You can’t perform that action at this time.
0 commit comments