HttpUtil { public static String authHeaderBasic(final String login, final String password) { if (Strings.isNullOrEmpty(login) || Strings.isNullOrEmpty(password)) { return ""; } byte[] bytesEncoded = Base64.encodeBase64((login + ":" + password).getBytes(UTF8)); return "Basic " + new String(bytesEncoded, UTF8); } private  HttpUtil(); static String authHeaderBasic(final String login,
                                         final String password); static String authHeaderBasic(final BigInteger login,
                                         final String password); static String authHeaderBearer(final BigInteger token); static String authHeaderBearer(final String token); static MultivaluedMap<String, String> parseQueryParams(
            final URI uri); static MultivaluedMap<String, String> parseQueryParams(
            final String query); static MultivaluedMap<String, String> parseBodyParams(
            final Response response);  }
@Test public void authHeaderBasic() { assertEquals("Basic bG9naW46cGFzc3dvcmQ=", HttpUtil.authHeaderBasic("login", "password")); assertEquals("", HttpUtil.authHeaderBasic((String) null, "password")); assertEquals("", HttpUtil.authHeaderBasic("login", null)); assertEquals("Basic MDAwMDAwMDAwMDAwMDAwMDAwMDAw" + "MDAwMDAwMDAwMGE6cGFzc3dvcmQ=", HttpUtil.authHeaderBasic(BigInteger.TEN, "password")); }