### Question:
OAuthUtils { public static String[] decodeClientAuthenticationHeader(String authenticationHeader) { if (isEmpty(authenticationHeader)) { return null; } String[] tokens = authenticationHeader.split(" "); if (tokens.length != 2) { return null; } String authType = tokens[0]; if (!"basic".equalsIgnoreCase(authType)) { return null; } String encodedCreds = tokens[1]; return decodeBase64EncodedCredentials(encodedCreds); }  static String format(
        final Collection<? extends Map.Entry<String, Object>> parameters,
        final String encoding); static String saveStreamAsString(InputStream is); static String toString(
        final InputStream is, final String defaultCharset); static OAuthProblemException handleOAuthProblemException(String message); static OAuthProblemException handleMissingParameters(Set<String> missingParams); static OAuthProblemException handleBadContentTypeException(String expectedContentType); static OAuthProblemException handleNotAllowedParametersOAuthException(
        List<String> notAllowedParams); static Map<String, Object> decodeForm(String form); static boolean isFormEncoded(String contentType); static String decodePercent(String s); static String percentEncode(String s); static T instantiateClass(Class<T> clazz); static T instantiateClassWithParameters(Class<T> clazz, Class<?>[] paramsTypes,
                                                       Object[] paramValues); static String getAuthHeaderField(String authHeader); static Map<String, String> decodeOAuthHeader(String header); static String[] decodeClientAuthenticationHeader(String authenticationHeader); static String encodeOAuthHeader(Map<String, Object> entries); static String encodeAuthorizationBearerHeader(Map<String, Object> entries); static boolean isEmpty(String value); static boolean hasEmptyValues(String[] array); static String getAuthzMethod(String header); static Set<String> decodeScopes(String s); static String encodeScopes(Set<String> s); static boolean isMultipart(HttpServletRequest request); static boolean hasContentType(String requestContentType, String requiredContentType); static final String AUTH_SCHEME; static final String MULTIPART; }### Answer:
@Test public void testDecodeValidClientAuthnHeader() throws Exception { String header = "clientId:secret"; String encodedHeader = BASIC_PREFIX + encodeHeader(header); String[] credentials = OAuthUtils.decodeClientAuthenticationHeader(encodedHeader); assertNotNull(credentials); assertEquals("clientId", credentials[0]); assertEquals("secret", credentials[1]); }
@Test public void testDecodeValidClientAuthnHeaderWithColonInPassword() throws Exception { String header = "clientId:sec:re:t"; String encodedHeader = BASIC_PREFIX + encodeHeader(header); String[] credentials = OAuthUtils.decodeClientAuthenticationHeader(encodedHeader); assertNotNull(credentials); assertEquals("clientId", credentials[0]); assertEquals("sec:re:t", credentials[1]); }
@Test public void testDecodeEmptyClientAuthnHeader() throws Exception { assertNull(OAuthUtils.decodeClientAuthenticationHeader(null)); assertNull(OAuthUtils.decodeClientAuthenticationHeader("")); }
@Test public void testDecodeInvalidClientAuthnHeader() throws Exception { assertNull(OAuthUtils.decodeClientAuthenticationHeader(BASIC_PREFIX)); assertNull(OAuthUtils.decodeClientAuthenticationHeader("invalid_header")); assertNull(OAuthUtils.decodeClientAuthenticationHeader("Authorization dXNlcm5hbWU6cGFzc3dvcmQ=")); }
@Test public void testDecodeClientAuthnHeaderNoClientIdOrSecret() throws Exception { String header = ":"; String encodedHeader = BASIC_PREFIX + encodeHeader(header); assertNull(OAuthUtils.decodeClientAuthenticationHeader(encodedHeader)); }
@Test public void testDecodeClientAuthnHeaderNoClientId() throws Exception { String header = ":secret"; String encodedHeader = BASIC_PREFIX + encodeHeader(header); assertNull(OAuthUtils.decodeClientAuthenticationHeader(encodedHeader)); }
@Test public void testDecodeClientAuthnHeaderNoSecret() throws Exception { String header = "clientId:"; String encodedHeader = BASIC_PREFIX + encodeHeader(header); assertNull(OAuthUtils.decodeClientAuthenticationHeader(encodedHeader)); }
@Test public void testDecodeClientAuthnHeaderNoSeparator() throws Exception { String header = "clientId"; String encodedHeader = BASIC_PREFIX + encodeHeader(header); assertNull(OAuthUtils.decodeClientAuthenticationHeader(encodedHeader)); }