@@ -103,10 +103,10 @@ void givenValidPlayer_whenPost_thenReturnsCreated()
103103 /**
104104 * Given invalid player data is provided (validation fails)
105105 * When attempting to create a player
106- * Then response status is 400 Bad Request and service is never called
106+ * Then response status is 422 Unprocessable Entity and service is never called
107107 */
108108 @ Test
109- void givenInvalidPlayer_whenPost_thenReturnsBadRequest ()
109+ void givenInvalidPlayer_whenPost_thenReturnsUnprocessableEntity ()
110110 throws Exception {
111111 // Given
112112 PlayerDTO dto = PlayerDTOFakes .createOneInvalid ();
@@ -122,7 +122,7 @@ void givenInvalidPlayer_whenPost_thenReturnsBadRequest()
122122 .getResponse ();
123123 // Then
124124 verify (playersServiceMock , never ()).create (any (PlayerDTO .class ));
125- then (response .getStatus ()).isEqualTo (HttpStatus .BAD_REQUEST .value ());
125+ then (response .getStatus ()).isEqualTo (HttpStatus .UNPROCESSABLE_ENTITY .value ());
126126 }
127127
128128 /**
@@ -437,10 +437,10 @@ void givenUnknownPlayer_whenPut_thenReturnsNotFound()
437437 /**
438438 * Given invalid player data is provided (validation fails)
439439 * When attempting to update a player
440- * Then response status is 400 Bad Request and service is never called
440+ * Then response status is 422 Unprocessable Entity and service is never called
441441 */
442442 @ Test
443- void givenInvalidPlayer_whenPut_thenReturnsBadRequest ()
443+ void givenInvalidPlayer_whenPut_thenReturnsUnprocessableEntity ()
444444 throws Exception {
445445 // Given
446446 PlayerDTO dto = PlayerDTOFakes .createOneInvalid ();
@@ -456,16 +456,16 @@ void givenInvalidPlayer_whenPut_thenReturnsBadRequest()
456456 .getResponse ();
457457 // Then
458458 verify (playersServiceMock , never ()).update (anyInt (), any (PlayerDTO .class ));
459- then (response .getStatus ()).isEqualTo (HttpStatus .BAD_REQUEST .value ());
459+ then (response .getStatus ()).isEqualTo (HttpStatus .UNPROCESSABLE_ENTITY .value ());
460460 }
461461
462462 /**
463463 * Given the path squad number does not match the body squad number
464464 * When attempting to update a player
465- * Then response status is 400 Bad Request and service is never called
465+ * Then response status is 422 Unprocessable Entity and service is never called
466466 */
467467 @ Test
468- void givenSquadNumberMismatch_whenPut_thenReturnsBadRequest ()
468+ void givenSquadNumberMismatch_whenPut_thenReturnsUnprocessableEntity ()
469469 throws Exception {
470470 // Given
471471 PlayerDTO dto = PlayerDTOFakes .createOneValid ();
@@ -483,16 +483,16 @@ void givenSquadNumberMismatch_whenPut_thenReturnsBadRequest()
483483 .getResponse ();
484484 // Then
485485 verify (playersServiceMock , never ()).update (anyInt (), any (PlayerDTO .class ));
486- then (response .getStatus ()).isEqualTo (HttpStatus .BAD_REQUEST .value ());
486+ then (response .getStatus ()).isEqualTo (HttpStatus .UNPROCESSABLE_ENTITY .value ());
487487 }
488488
489489 /**
490490 * Given the body squad number is null
491491 * When attempting to update a player
492- * Then response status is 400 Bad Request (squad number is required)
492+ * Then response status is 422 Unprocessable Entity (squad number is required)
493493 */
494494 @ Test
495- void givenNullBodySquadNumber_whenPut_thenReturnsBadRequest ()
495+ void givenNullBodySquadNumber_whenPut_thenReturnsUnprocessableEntity ()
496496 throws Exception {
497497 // Given
498498 PlayerDTO dto = PlayerDTOFakes .createOneValid ();
@@ -509,7 +509,7 @@ void givenNullBodySquadNumber_whenPut_thenReturnsBadRequest()
509509 .getResponse ();
510510 // Then
511511 verify (playersServiceMock , never ()).update (anyInt (), any (PlayerDTO .class ));
512- then (response .getStatus ()).isEqualTo (HttpStatus .BAD_REQUEST .value ());
512+ then (response .getStatus ()).isEqualTo (HttpStatus .UNPROCESSABLE_ENTITY .value ());
513513 }
514514
515515 /*
0 commit comments