### Question:
RequestParser { @VisibleForTesting static Pair<String, String> decodeBasicAuthorization( String encodedAuthorization ) { if ( !Base64.isBase64( encodedAuthorization ) ) { throw new UnauthorizedAccessException( "Basic Authorization header is not properly encoded." ); } final String encodedHeader = StringUtils.substringAfter( encodedAuthorization, "Basic" ); final String decodedHeader = new String( Base64.decodeBase64( encodedHeader ) ); final String[] decoded = StringUtils.splitPreserveAllTokens( decodedHeader, ":" ); return new Pair<>( decoded[0], decoded[1] ); } RequestParser( final TransactionManager transactionManager, final Authenticator authenticator, final String databaseName, final String userName ); @VisibleForTesting  RequestParser( Catalog catalog, TransactionManager transactionManager, Authenticator authenticator, String databaseName, String userName ); CatalogUser parseBasicAuthentication( Request request ); ResourceGetRequest parseGetResourceRequest( Request request, String resourceName ); ResourcePostRequest parsePostResourceRequest( Request request, String resourceName, Gson gson ); ResourcePatchRequest parsePatchResourceRequest( Request request, String resourceName, Gson gson ); ResourceDeleteRequest parseDeleteResourceRequest( Request request, String resourceName ); Map<String, CatalogColumn> generateNameMapping( List<CatalogTable> tables );  }### Answer:
@Test public void testBasicAuthorizationDecoding() { Pair<String, String> unibasDbis = RequestParser.decodeBasicAuthorization( "Basic dW5pYmFzOmRiaXM=" ); assertEquals("Username was decoded incorrectly.", "unibas", unibasDbis.left ); assertEquals("Password was decoded incorrectly.", "dbis", unibasDbis.right ); }
@Test public void testBasicAuthorizationDecodingGarbageHeader() { thrown.expect( UnauthorizedAccessException.class ); thrown.expectMessage( "Basic Authorization header is not properly encoded." ); Pair<String, String> unibasDbis = RequestParser.decodeBasicAuthorization( "Basic dW5pY!mFzOmRi!" ); assertEquals("Username was decoded incorrectly.", "unibas", unibasDbis.left ); assertEquals("Password was decoded incorrectly.", "dbis", unibasDbis.right ); }