@Test
    void testDigestAuthenticationWithInvalidUsernameAndValidUsernameStar() throws Exception {
        final ClassicHttpRequest request = new BasicClassicHttpRequest("POST", "/");
        final HttpHost host = new HttpHost("somehost", 80);
        final CredentialsProvider credentialsProvider = CredentialsProviderBuilder.create()
                .add(new AuthScope(host, "realm1", null), "invalid\"username", "password".toCharArray())
                .build();

        final String encodedUsername = "UTF-8''J%C3%A4s%C3%B8n%20Doe";
        final String challenge = StandardAuthScheme.DIGEST + " realm=\"realm1\", nonce=\"f2a3f18799759d4f1a1c068b92b573cb\", " +
                "qop=\"auth-int\", username*=\"" + encodedUsername + "\"";
        final AuthChallenge authChallenge = parse(challenge);
        final DigestScheme authscheme = new DigestScheme();
        authscheme.processChallenge(authChallenge, null);

        Assertions.assertTrue(authscheme.isResponseReady(host, credentialsProvider, null));

        final String authResponse = authscheme.generateAuthResponse(host, request, null);
        Assertions.assertNotNull(authResponse);
    }
Test digest authentication with unknown qop value
httpclient5/src/test/java/org/apache/hc/client5/http/impl/auth/TestDigestScheme.java