madrob commented on code in PR #2496:
URL: https://github.com/apache/solr/pull/2496#discussion_r1627568175
##########
solr/core/src/test/org/apache/solr/handler/api/V2ApiUtilsTest.java:
##########
@@ -36,4 +40,21 @@ public void testReadsDisableV2ApiSysprop() {
assertFalse(
"v2 API should be disabled if sysprop explicitly disables it",
V2ApiUtils.isEnabled());
}
+
+ @Test
+ public void testConvertsWtToMediaTypeString() {
+ assertEquals(
+ "someDefault",
+ V2ApiUtils.getMediaTypeFromWtParam(new ModifiableSolrParams(),
"someDefault"));
+
+ var params = new ModifiableSolrParams();
+ params.add("wt", "json");
+ assertEquals(MediaType.APPLICATION_JSON,
V2ApiUtils.getMediaTypeFromWtParam(params, null));
+
+ params.set("wt", "xml");
+ assertEquals(MediaType.APPLICATION_XML,
V2ApiUtils.getMediaTypeFromWtParam(params, null));
+
+ params.set("wt", "javabin");
+ assertEquals(BINARY_CONTENT_TYPE_V2,
V2ApiUtils.getMediaTypeFromWtParam(params, null));
+ }
Review Comment:
You're missing test coverage for an unknown type
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]