@Test public void shouldSanitizeTags() { assertThat(SwaggerHelper.sanitizeTag("tag")).isEqualTo("tag"); assertThat(SwaggerHelper.sanitizeTag(".]t%a$g#[/")).isEqualTo("tag"); final char[] str = new char[1024]; final String randomString = IntStream.range(0, str.length) .map(x -> (int) (Character.MAX_CODE_POINT * Math.random())).mapToObj(i -> new String(Character.toChars(i))) .collect(Collectors.joining("")); final String sanitized = SwaggerHelper.sanitizeTag(randomString); assertThatCode(() -> JsonRecordSupport.validateKey(sanitized)).doesNotThrowAnyException(); }