ContentTypeUtils { public static boolean belongsToBlackList(String... content) { if (ArrayUtils.isEmpty(content)) return false; return Arrays.stream(blackList).anyMatch(Arrays.asList(content)::contains); } private  ContentTypeUtils(); static boolean belongsToBlackList(String... content);  }
@Test public void permitEmptyContentTypeInBlackList() { String contentType = ""; String[] types = contentType.split(";"); boolean belongsToBlackList = ContentTypeUtils.belongsToBlackList(types); assertEquals(false, belongsToBlackList); }
@Test public void blockPdfContentType() { String contentType = "application/pdf;charset=UTF-8"; String[] types = contentType.split(";"); boolean belongsToBlackList = ContentTypeUtils.belongsToBlackList(types); assertEquals(true, belongsToBlackList); }
@Test public void permitJSONContentTypeInBlackList() { String contentType = "application/json"; String[] types = contentType.split(";"); boolean belongsToBlackList = ContentTypeUtils.belongsToBlackList(types); assertEquals(false, belongsToBlackList); }