From 2b5b4e8fa3670073fc18149915422fa8e9d1b1ae Mon Sep 17 00:00:00 2001 From: cryptoe Date: Thu, 14 Aug 2025 16:08:46 +0530 Subject: [PATCH 1/6] Restoring support for parameters in media types for the sql query endpoint. --- .../druid/tests/query/ITSqlQueryTest.java | 11 ++++++++++ .../org/apache/druid/sql/http/SqlQuery.java | 21 ++++++++++--------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/integration-tests/src/test/java/org/apache/druid/tests/query/ITSqlQueryTest.java b/integration-tests/src/test/java/org/apache/druid/tests/query/ITSqlQueryTest.java index 05fca8cf3027..12a8cc65d3d8 100644 --- a/integration-tests/src/test/java/org/apache/druid/tests/query/ITSqlQueryTest.java +++ b/integration-tests/src/test/java/org/apache/druid/tests/query/ITSqlQueryTest.java @@ -220,6 +220,17 @@ public void testJSON() Assert.assertEquals(responseBody, "[{\"EXPR$0\":567}]"); } ); + + executeQuery( + "application/json; charset=UTF-8", + "{\"query\":\"select 567\"}", + (request) -> { + }, + (statusCode, responseBody) -> { + Assert.assertEquals(statusCode, 200, responseBody); + Assert.assertEquals(responseBody, "[{\"EXPR$0\":567}]"); + } + ); } @Test diff --git a/sql/src/main/java/org/apache/druid/sql/http/SqlQuery.java b/sql/src/main/java/org/apache/druid/sql/http/SqlQuery.java index 022a3c4ed54f..a6f47201ec64 100644 --- a/sql/src/main/java/org/apache/druid/sql/http/SqlQuery.java +++ b/sql/src/main/java/org/apache/druid/sql/http/SqlQuery.java @@ -277,26 +277,25 @@ private static SqlQuery from( ISqlQueryExtractor rawQueryExtractor ) throws HttpException { + if (contentType == null) { + throw new HttpException(Response.Status.BAD_REQUEST, "Missing Content-Type header"); + } try { - if (MediaType.APPLICATION_JSON.equals(contentType)) { + final MediaType requestMediaType = MediaType.valueOf(contentType); + if (MediaType.APPLICATION_JSON_TYPE.isCompatible(requestMediaType)) { SqlQuery sqlQuery = jsonQueryExtractor.extract(); if (sqlQuery == null) { throw new HttpException(Response.Status.BAD_REQUEST, "Empty query"); } return sqlQuery; - - } else if (MediaType.TEXT_PLAIN.equals(contentType)) { - + } else if (MediaType.TEXT_PLAIN_TYPE.isCompatible(requestMediaType)) { String sql = rawQueryExtractor.extract().trim(); if (sql.isEmpty()) { throw new HttpException(Response.Status.BAD_REQUEST, "Empty query"); } - return new SqlQuery(sql, null, false, false, false, null, null); - - } else if (MediaType.APPLICATION_FORM_URLENCODED.equals(contentType)) { - + } else if (MediaType.APPLICATION_FORM_URLENCODED_TYPE.isCompatible(requestMediaType)) { String sql = rawQueryExtractor.extract().trim(); if (sql.isEmpty()) { throw new HttpException(Response.Status.BAD_REQUEST, "Empty query"); @@ -313,13 +312,12 @@ private static SqlQuery from( } return new SqlQuery(sql, null, false, false, false, null, null); - } else { throw new HttpException( Response.Status.UNSUPPORTED_MEDIA_TYPE, StringUtils.format( "Unsupported Content-Type: %s. Only application/json, text/plain or application/x-www-form-urlencoded is supported.", - contentType + requestMediaType.toString() ) ); } @@ -343,5 +341,8 @@ private static SqlQuery from( catch (IOException e) { throw new HttpException(Response.Status.BAD_REQUEST, "Unable to read query from request: " + e.getMessage()); } + catch (IllegalArgumentException e) { + throw new HttpException(Response.Status.BAD_REQUEST, "Invalid Content-Type header: " + e.getMessage()); + } } } From d5e9df8dc8c0ff9ebef60f09d6b82d9d6fec63f6 Mon Sep 17 00:00:00 2001 From: cryptoe Date: Thu, 14 Aug 2025 19:29:21 +0530 Subject: [PATCH 2/6] Adding more tests. --- .../apache/druid/sql/http/SqlResource.java | 28 +- .../apache/druid/sql/http/SqlQueryTest.java | 357 ++++++++++++++++++ 2 files changed, 374 insertions(+), 11 deletions(-) create mode 100644 sql/src/test/java/org/apache/druid/sql/http/SqlQueryTest.java diff --git a/sql/src/main/java/org/apache/druid/sql/http/SqlResource.java b/sql/src/main/java/org/apache/druid/sql/http/SqlResource.java index 3b35669ac77a..57df7c18945b 100644 --- a/sql/src/main/java/org/apache/druid/sql/http/SqlResource.java +++ b/sql/src/main/java/org/apache/druid/sql/http/SqlResource.java @@ -47,6 +47,7 @@ import javax.annotation.Nullable; import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.POST; @@ -114,6 +115,22 @@ public Response getSupportedEngines(@Context final HttpServletRequest request) return Response.ok(new SupportedEnginesResponse(engines)).build(); } + @POST + @Produces(MediaType.APPLICATION_JSON) + @Consumes({ + MediaType.APPLICATION_JSON, + MediaType.TEXT_PLAIN, + MediaType.APPLICATION_FORM_URLENCODED, + }) + @Nullable + public Response doPost( + @Context final HttpServletRequest req, + @Context final HttpContext httpContext + ) + { + return doPost(SqlQuery.from(httpContext), req); + } + /** * API to list all running queries, for all engines that supports such listings. * @@ -147,17 +164,6 @@ public Response doGetRunningQueries( return Response.ok().entity(new GetQueriesResponse(queries)).build(); } - @POST - @Produces(MediaType.APPLICATION_JSON) - @Nullable - public Response doPost( - @Context final HttpServletRequest req, - @Context final HttpContext httpContext - ) - { - return doPost(SqlQuery.from(httpContext), req); - } - /** * This method is defined as public so that tests can access it */ diff --git a/sql/src/test/java/org/apache/druid/sql/http/SqlQueryTest.java b/sql/src/test/java/org/apache/druid/sql/http/SqlQueryTest.java new file mode 100644 index 000000000000..90aac37aa455 --- /dev/null +++ b/sql/src/test/java/org/apache/druid/sql/http/SqlQueryTest.java @@ -0,0 +1,357 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.druid.sql.http; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.apache.druid.jackson.DefaultObjectMapper; +import org.apache.druid.server.initialization.jetty.HttpException; +import org.easymock.EasyMock; +import org.junit.Assert; +import org.junit.Test; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.core.Response; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; + +public class SqlQueryTest +{ + private final ObjectMapper objectMapper = new DefaultObjectMapper(); + + @Test + public void testFromHttpServletRequestWithJsonContentType() throws Exception + { + String jsonQuery = "{\"query\":\"SELECT 1\"}"; + HttpServletRequest request = createMockRequest("application/json", jsonQuery); + + SqlQuery result = SqlQuery.from(request, objectMapper); + + Assert.assertEquals("SELECT 1", result.getQuery()); + } + + @Test + public void testFromHttpServletRequestWithJsonContentTypeAndCharset() throws Exception + { + String jsonQuery = "{\"query\":\"SELECT 2\"}"; + HttpServletRequest request = createMockRequest("application/json; charset=UTF-8", jsonQuery); + + SqlQuery result = SqlQuery.from(request, objectMapper); + + Assert.assertEquals("SELECT 2", result.getQuery()); + } + + @Test + public void testFromHttpServletRequestWithJsonContentTypeAndMultipleParams() throws Exception + { + String jsonQuery = "{\"query\":\"SELECT 3\"}"; + HttpServletRequest request = createMockRequest("application/json; charset=UTF-8; boundary=something", jsonQuery); + + SqlQuery result = SqlQuery.from(request, objectMapper); + + Assert.assertEquals("SELECT 3", result.getQuery()); + } + + @Test + public void testFromHttpServletRequestWithTextPlainContentType() throws Exception + { + String textQuery = "SELECT 4"; + HttpServletRequest request = createMockRequest("text/plain", textQuery); + + SqlQuery result = SqlQuery.from(request, objectMapper); + + Assert.assertEquals("SELECT 4", result.getQuery()); + } + + @Test + public void testFromHttpServletRequestWithTextPlainContentTypeAndCharset() throws Exception + { + String textQuery = "SELECT 5"; + HttpServletRequest request = createMockRequest("text/plain; charset=ISO-8859-1", textQuery); + + SqlQuery result = SqlQuery.from(request, objectMapper); + + Assert.assertEquals("SELECT 5", result.getQuery()); + } + + @Test + public void testFromHttpServletRequestWithFormUrlencodedContentType() throws Exception + { + String formQuery = "SELECT 6"; + HttpServletRequest request = createMockRequest("application/x-www-form-urlencoded", formQuery); + + SqlQuery result = SqlQuery.from(request, objectMapper); + + Assert.assertEquals("SELECT 6", result.getQuery()); + } + + @Test + public void testFromHttpServletRequestWithFormUrlencodedContentTypeAndCharset() throws Exception + { + String formQuery = "SELECT 7"; + HttpServletRequest request = createMockRequest("application/x-www-form-urlencoded; charset=UTF-8", formQuery); + + SqlQuery result = SqlQuery.from(request, objectMapper); + + Assert.assertEquals("SELECT 7", result.getQuery()); + } + + @Test + public void testFromHttpServletRequestWithNullContentType() throws Exception + { + String content = "SELECT 8"; + HttpServletRequest request = createMockRequest(null, content); + + HttpException exception = Assert.assertThrows( + HttpException.class, + () -> SqlQuery.from(request, objectMapper) + ); + + Assert.assertEquals(Response.Status.BAD_REQUEST, exception.getStatusCode()); + Assert.assertEquals("Missing Content-Type header", exception.getMessage()); + } + + @Test + public void testFromHttpServletRequestWithUnsupportedContentType() throws Exception + { + String xmlQuery = "SELECT 9"; + HttpServletRequest request = createMockRequest("application/xml", xmlQuery); + + HttpException exception = Assert.assertThrows( + HttpException.class, + () -> SqlQuery.from(request, objectMapper) + ); + + Assert.assertEquals(Response.Status.UNSUPPORTED_MEDIA_TYPE, exception.getStatusCode()); + Assert.assertTrue(exception.getMessage().contains("Unsupported Content-Type")); + Assert.assertTrue(exception.getMessage().contains("application/xml")); + } + + @Test + public void testFromHttpServletRequestWithUnsupportedContentTypeWithParams() throws Exception + { + String xmlQuery = "SELECT 10"; + HttpServletRequest request = createMockRequest("application/xml; charset=UTF-8", xmlQuery); + + HttpException exception = Assert.assertThrows( + HttpException.class, + () -> SqlQuery.from(request, objectMapper) + ); + + Assert.assertEquals(Response.Status.UNSUPPORTED_MEDIA_TYPE, exception.getStatusCode()); + Assert.assertTrue(exception.getMessage().contains("Unsupported Content-Type")); + Assert.assertTrue(exception.getMessage().contains("application/xml")); + } + + @Test + public void testFromHttpServletRequestWithInvalidContentTypeFormat() throws Exception + { + String content = "SELECT 11"; + HttpServletRequest request = createMockRequest("invalid-content-type-format", content); + + HttpException exception = Assert.assertThrows( + HttpException.class, + () -> SqlQuery.from(request, objectMapper) + ); + + Assert.assertEquals(Response.Status.BAD_REQUEST, exception.getStatusCode()); + Assert.assertTrue(exception.getMessage().contains("Invalid Content-Type header")); + } + + @Test + public void testFromHttpServletRequestWithEmptyJsonQuery() throws Exception + { + String jsonQuery = "{}"; + HttpServletRequest request = createMockRequest("application/json", jsonQuery); + + HttpException exception = Assert.assertThrows( + HttpException.class, + () -> SqlQuery.from(request, objectMapper) + ); + + Assert.assertEquals(Response.Status.BAD_REQUEST, exception.getStatusCode()); + Assert.assertTrue(exception.getMessage() + .contains("Unable to read query from request: Cannot construct instance of ")); + } + + @Test + public void testFromHttpServletRequestWithNullJsonQuery() throws Exception + { + String jsonQuery = "{\"query\": null}"; + HttpServletRequest request = createMockRequest("application/json", jsonQuery); + + HttpException exception = Assert.assertThrows( + HttpException.class, + () -> SqlQuery.from(request, objectMapper) + ); + + Assert.assertEquals(Response.Status.BAD_REQUEST, exception.getStatusCode()); + } + + @Test + public void testFromHttpServletRequestWithEmptyTextQuery() throws Exception + { + String textQuery = ""; + HttpServletRequest request = createMockRequest("text/plain", textQuery); + + HttpException exception = Assert.assertThrows( + HttpException.class, + () -> SqlQuery.from(request, objectMapper) + ); + + Assert.assertEquals(Response.Status.BAD_REQUEST, exception.getStatusCode()); + Assert.assertEquals("Empty query", exception.getMessage()); + } + + @Test + public void testFromHttpServletRequestWithWhitespaceOnlyTextQuery() throws Exception + { + String textQuery = " \n\t "; + HttpServletRequest request = createMockRequest("text/plain", textQuery); + + HttpException exception = Assert.assertThrows( + HttpException.class, + () -> SqlQuery.from(request, objectMapper) + ); + + Assert.assertEquals(Response.Status.BAD_REQUEST, exception.getStatusCode()); + Assert.assertEquals("Empty query", exception.getMessage()); + } + + @Test + public void testFromHttpServletRequestWithEmptyFormUrlencodedQuery() throws Exception + { + String formQuery = ""; + HttpServletRequest request = createMockRequest("application/x-www-form-urlencoded", formQuery); + + HttpException exception = Assert.assertThrows( + HttpException.class, + () -> SqlQuery.from(request, objectMapper) + ); + + Assert.assertEquals(Response.Status.BAD_REQUEST, exception.getStatusCode()); + Assert.assertEquals("Empty query", exception.getMessage()); + } + + + @Test + public void testFromHttpServletRequestWithMalformedJson() throws Exception + { + String malformedJson = "{\"query\":\"SELECT 12\""; // Missing closing brace + HttpServletRequest request = createMockRequest("application/json", malformedJson); + + HttpException exception = Assert.assertThrows( + HttpException.class, + () -> SqlQuery.from(request, objectMapper) + ); + + Assert.assertEquals(Response.Status.BAD_REQUEST, exception.getStatusCode()); + Assert.assertTrue(exception.getMessage().contains("Malformed SQL query wrapped in JSON: Unexpected end-of-input:")); + } + + @Test + public void testFromHttpServletRequestWithCaseInsensitiveContentType() throws Exception + { + // Test various case combinations + String jsonQuery = "{\"query\":\"SELECT 13\"}"; + + HttpServletRequest request1 = createMockRequest("APPLICATION/JSON", jsonQuery); + SqlQuery result1 = SqlQuery.from(request1, objectMapper); + Assert.assertEquals("SELECT 13", result1.getQuery()); + + HttpServletRequest request2 = createMockRequest("Application/Json; Charset=UTF-8", jsonQuery); + SqlQuery result2 = SqlQuery.from(request2, objectMapper); + Assert.assertEquals("SELECT 13", result2.getQuery()); + + String textQuery = "SELECT 14"; + HttpServletRequest request3 = createMockRequest("TEXT/PLAIN", textQuery); + SqlQuery result3 = SqlQuery.from(request3, objectMapper); + Assert.assertEquals("SELECT 14", result3.getQuery()); + } + + @Test + public void testFromHttpServletRequestWithComplexJsonQuery() throws Exception + { + String complexJsonQuery = "{\"query\":\"SELECT COUNT(*) FROM table WHERE col > 100\", \"context\":{\"timeout\":30000}, \"header\":true}"; + HttpServletRequest request = createMockRequest("application/json; charset=UTF-8", complexJsonQuery); + + SqlQuery result = SqlQuery.from(request, objectMapper); + + Assert.assertEquals("SELECT COUNT(*) FROM table WHERE col > 100", result.getQuery()); + Assert.assertTrue(result.includeHeader()); + Assert.assertNotNull(result.getContext()); + } + + + private HttpServletRequest createMockRequest(String contentType, String content) throws IOException + { + HttpServletRequest request = EasyMock.createMock(HttpServletRequest.class); + EasyMock.expect(request.getContentType()).andReturn(contentType).anyTimes(); + + InputStream inputStream = new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8)); + EasyMock.expect(request.getInputStream()).andReturn(new ServletInputStreamWrapper(inputStream)).anyTimes(); + + EasyMock.replay(request); + return request; + } + + /** + * Helper class to wrap InputStream as ServletInputStream since EasyMock needs concrete implementation + */ + private static class ServletInputStreamWrapper extends javax.servlet.ServletInputStream + { + private final InputStream inputStream; + + public ServletInputStreamWrapper(InputStream inputStream) + { + this.inputStream = inputStream; + } + + @Override + public int read() throws IOException + { + return inputStream.read(); + } + + @Override + public boolean isFinished() + { + try { + return inputStream.available() == 0; + } + catch (IOException e) { + return true; + } + } + + @Override + public boolean isReady() + { + return true; + } + + @Override + public void setReadListener(javax.servlet.ReadListener readListener) + { + // Not implemented for testing + } + } +} From 90b204a2524867fe2dd2993afb5559d88866f7fc Mon Sep 17 00:00:00 2001 From: cryptoe Date: Thu, 14 Aug 2025 23:38:17 +0530 Subject: [PATCH 3/6] Fixing catch block --- .../java/org/apache/druid/sql/http/SqlQuery.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/sql/src/main/java/org/apache/druid/sql/http/SqlQuery.java b/sql/src/main/java/org/apache/druid/sql/http/SqlQuery.java index a6f47201ec64..1c76d2eaa370 100644 --- a/sql/src/main/java/org/apache/druid/sql/http/SqlQuery.java +++ b/sql/src/main/java/org/apache/druid/sql/http/SqlQuery.java @@ -280,10 +280,16 @@ private static SqlQuery from( if (contentType == null) { throw new HttpException(Response.Status.BAD_REQUEST, "Missing Content-Type header"); } + + final MediaType requestMediaType; + try { + requestMediaType = MediaType.valueOf(contentType); + } + catch (IllegalArgumentException e) { + throw new HttpException(Response.Status.BAD_REQUEST, "Invalid Content-Type header: " + e.getMessage()); + } try { - final MediaType requestMediaType = MediaType.valueOf(contentType); if (MediaType.APPLICATION_JSON_TYPE.isCompatible(requestMediaType)) { - SqlQuery sqlQuery = jsonQueryExtractor.extract(); if (sqlQuery == null) { throw new HttpException(Response.Status.BAD_REQUEST, "Empty query"); @@ -310,7 +316,6 @@ private static SqlQuery from( "Unable to decode URL-Encoded SQL query: " + e.getMessage() ); } - return new SqlQuery(sql, null, false, false, false, null, null); } else { throw new HttpException( @@ -341,8 +346,5 @@ private static SqlQuery from( catch (IOException e) { throw new HttpException(Response.Status.BAD_REQUEST, "Unable to read query from request: " + e.getMessage()); } - catch (IllegalArgumentException e) { - throw new HttpException(Response.Status.BAD_REQUEST, "Invalid Content-Type header: " + e.getMessage()); - } } } From 52b1df97583620a9300818a85fc3ee69cdf51463 Mon Sep 17 00:00:00 2001 From: cryptoe Date: Wed, 20 Aug 2025 20:43:31 +0530 Subject: [PATCH 4/6] Adjusting test cases for consumes --- .../java/org/apache/druid/tests/query/ITSqlQueryTest.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/integration-tests/src/test/java/org/apache/druid/tests/query/ITSqlQueryTest.java b/integration-tests/src/test/java/org/apache/druid/tests/query/ITSqlQueryTest.java index 12a8cc65d3d8..ac6f947241dc 100644 --- a/integration-tests/src/test/java/org/apache/druid/tests/query/ITSqlQueryTest.java +++ b/integration-tests/src/test/java/org/apache/druid/tests/query/ITSqlQueryTest.java @@ -141,8 +141,7 @@ public void testNullContentType() (request) -> { }, (statusCode, responseBody) -> { - Assert.assertEquals(statusCode, HttpResponseStatus.UNSUPPORTED_MEDIA_TYPE.getCode(), responseBody); - assertStringCompare("Unsupported Content-Type:", responseBody, responseBody::contains); + Assert.assertEquals(statusCode, HttpResponseStatus.BAD_REQUEST.getCode(), responseBody); } ); } @@ -156,8 +155,7 @@ public void testUnsupportedContentType() (request) -> { }, (statusCode, responseBody) -> { - Assert.assertEquals(statusCode, HttpResponseStatus.UNSUPPORTED_MEDIA_TYPE.getCode(), responseBody); - assertStringCompare("Unsupported Content-Type:", responseBody, responseBody::contains); + Assert.assertEquals(statusCode, HttpResponseStatus.BAD_REQUEST, responseBody); } ); } From 2dc25b83720c57ace87a0ff66a7584a081134dce Mon Sep 17 00:00:00 2001 From: cryptoe Date: Fri, 22 Aug 2025 08:27:05 +0530 Subject: [PATCH 5/6] Fixing test cases. --- .../test/java/org/apache/druid/tests/query/ITSqlQueryTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration-tests/src/test/java/org/apache/druid/tests/query/ITSqlQueryTest.java b/integration-tests/src/test/java/org/apache/druid/tests/query/ITSqlQueryTest.java index ac6f947241dc..fc7e4320fd6e 100644 --- a/integration-tests/src/test/java/org/apache/druid/tests/query/ITSqlQueryTest.java +++ b/integration-tests/src/test/java/org/apache/druid/tests/query/ITSqlQueryTest.java @@ -155,7 +155,7 @@ public void testUnsupportedContentType() (request) -> { }, (statusCode, responseBody) -> { - Assert.assertEquals(statusCode, HttpResponseStatus.BAD_REQUEST, responseBody); + Assert.assertEquals(statusCode, HttpResponseStatus.UNSUPPORTED_MEDIA_TYPE, responseBody); } ); } From 8f139bdf5fb5dead3fe02fe36f667faa0b81fb66 Mon Sep 17 00:00:00 2001 From: cryptoe Date: Fri, 22 Aug 2025 11:43:04 +0530 Subject: [PATCH 6/6] Fixing test cases. --- .../test/java/org/apache/druid/tests/query/ITSqlQueryTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration-tests/src/test/java/org/apache/druid/tests/query/ITSqlQueryTest.java b/integration-tests/src/test/java/org/apache/druid/tests/query/ITSqlQueryTest.java index fc7e4320fd6e..aa6f02561716 100644 --- a/integration-tests/src/test/java/org/apache/druid/tests/query/ITSqlQueryTest.java +++ b/integration-tests/src/test/java/org/apache/druid/tests/query/ITSqlQueryTest.java @@ -155,7 +155,7 @@ public void testUnsupportedContentType() (request) -> { }, (statusCode, responseBody) -> { - Assert.assertEquals(statusCode, HttpResponseStatus.UNSUPPORTED_MEDIA_TYPE, responseBody); + Assert.assertEquals(statusCode, HttpResponseStatus.UNSUPPORTED_MEDIA_TYPE.getCode(), responseBody); } ); }