### Question:
JwtBundle implements BundleSource<JwtBundle> { public static JwtBundle parse( @NonNull final TrustDomain trustDomain, @NonNull final byte[] bundleBytes) throws JwtBundleException { try { val jwkSet = JWKSet.parse(new String(bundleBytes)); return toJwtBundle(trustDomain, jwkSet); } catch (ParseException | JOSEException | KeyException e) { throw new JwtBundleException("Could not parse bundle from bytes", e); } } JwtBundle(@NonNull final TrustDomain trustDomain);  JwtBundle(@NonNull final TrustDomain trustDomain, @NonNull final Map<String, PublicKey> jwtAuthorities); static JwtBundle load(@NonNull final TrustDomain trustDomain, @NonNull final Path bundlePath); static JwtBundle parse(
            @NonNull final TrustDomain trustDomain,
            @NonNull final byte[] bundleBytes); @Override JwtBundle getBundleForTrustDomain(final TrustDomain trustDomain); Map<String, PublicKey> getJwtAuthorities(); PublicKey findJwtAuthority(final String keyId); boolean hasJwtAuthority(final String keyId); void putJwtAuthority(@NonNull final String keyId, @NonNull final PublicKey jwtAuthority); void removeJwtAuthority(final String keyId);  }### Answer:
@Test void testParse_MissingKid_Fails() throws URISyntaxException, IOException { Path path = Paths.get(toUri("testdata/jwtbundle/jwks_missing_kid.json")); byte[] bundleBytes = Files.readAllBytes(path); TrustDomain trustDomain = TrustDomain.of("domain.test"); try { JwtBundle.parse(trustDomain, bundleBytes); fail("should have thrown exception"); } catch (JwtBundleException e) { assertEquals("Error adding authority of JWKS: keyID cannot be empty", e.getMessage()); } }
@Test void testParseInvalidJson() throws KeyException { try { JwtBundle.parse(TrustDomain.of("example.org"), "invalid json".getBytes()); fail("exception is expected"); } catch (JwtBundleException e) { assertEquals("Could not parse bundle from bytes", e.getMessage()); } }
@Test void testParse_NullTrustDomain_ThrowsNullPointerException() throws KeyException, JwtBundleException { try { JwtBundle.parse(null, "json".getBytes()); } catch (NullPointerException e) { assertEquals("trustDomain is marked non-null but is null", e.getMessage()); } }
@Test void testParse_NullBundleBytes_ThrowsNullPointerException() throws KeyException, JwtBundleException { try { JwtBundle.parse(TrustDomain.of("example.org"), null); } catch (NullPointerException e) { assertEquals("bundleBytes is marked non-null but is null", e.getMessage()); } }