AcmeUtils { @Nullable public static String stripErrorPrefix(@Nullable String type) { if (type != null && type.startsWith(ACME_ERROR_PREFIX)) { return type.substring(ACME_ERROR_PREFIX.length()); } else { return null; } } private  AcmeUtils(); static byte[] sha256hash(String z); static String hexEncode(byte[] data); static String base64UrlEncode(byte[] data); static byte[] base64UrlDecode(String base64); static boolean isValidBase64Url(@Nullable String base64); static String toAce(String domain); static Instant parseTimestamp(String str); @Nullable static String stripErrorPrefix(@Nullable String type); static void writeToPem(byte[] encoded, PemLabel label, Writer out); @Nullable static String getContentType(@Nullable String header); static void validateContact(URI contact);  }
@Test public void testStripErrorPrefix() { assertThat(stripErrorPrefix("urn:ietf:params:acme:error:unauthorized"), is("unauthorized")); assertThat(stripErrorPrefix("urn:somethingelse:error:message"), is(nullValue())); assertThat(stripErrorPrefix(null), is(nullValue())); }