@@ -58,7 +58,7 @@ void execute_ValidPayload_ReturnsResponse() {
5858 @ ParameterizedTest
5959 @ MethodSource ("provideErrorTestCases" )
6060 void execute_InvalidPayload_ReturnsErrorResponse (Exception exception ,
61- ErrorCode errorCode ) {
61+ ErrorCode errorCode , int statusCode ) {
6262 GetObjectRequest expectedRequest = GetObjectRequest .newBuilder ()
6363 .setStoreId (TEST_STORE_ID )
6464 .setKey (TEST_KEY )
@@ -73,16 +73,16 @@ void execute_InvalidPayload_ReturnsErrorResponse(Exception exception,
7373 .setMessage ("" )
7474 .build ();
7575 assertThat (response .getEntity (), is (expectedErrorResponse .toByteArray ()));
76- assertThat (response .getStatus (), is (expectedErrorResponse . getErrorCode (). getNumber () ));
76+ assertThat (response .getStatus (), is (statusCode ));
7777 verify (mockKVStore ).get (expectedRequest );
7878 }
7979
8080 private static Stream <Arguments > provideErrorTestCases () {
8181 return Stream .of (
82- Arguments .of (new ConflictException ("" ), ErrorCode .CONFLICT_EXCEPTION ),
83- Arguments .of (new IllegalArgumentException ("" ), ErrorCode .INVALID_REQUEST_EXCEPTION ),
84- Arguments .of (new NoSuchKeyException ("" ), ErrorCode .NO_SUCH_KEY_EXCEPTION ),
85- Arguments .of (new RuntimeException ("" ), ErrorCode .INTERNAL_SERVER_EXCEPTION )
82+ Arguments .of (new ConflictException ("" ), ErrorCode .CONFLICT_EXCEPTION , 409 ),
83+ Arguments .of (new IllegalArgumentException ("" ), ErrorCode .INVALID_REQUEST_EXCEPTION , 400 ),
84+ Arguments .of (new NoSuchKeyException ("" ), ErrorCode .NO_SUCH_KEY_EXCEPTION , 404 ),
85+ Arguments .of (new RuntimeException ("" ), ErrorCode .INTERNAL_SERVER_EXCEPTION , 500 )
8686 );
8787 }
8888}
0 commit comments