### Question:
JwtBundle implements BundleSource<JwtBundle> { public static JwtBundle load(@NonNull final TrustDomain trustDomain, @NonNull final Path bundlePath) throws KeyException, JwtBundleException { try { val jwkSet = JWKSet.load(bundlePath.toFile()); return toJwtBundle(trustDomain, jwkSet); } catch (IOException | ParseException | JOSEException e) { val error = "Could not load bundle from file: %s"; throw new JwtBundleException(String.format(error, bundlePath.toString()), 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 testLoadFile_MissingKid_ThrowsJwtBundleException() throws URISyntaxException, KeyException { Path path = Paths.get(toUri("testdata/jwtbundle/jwks_missing_kid.json")); TrustDomain trustDomain = TrustDomain.of("domain.test"); try { JwtBundle.load(trustDomain, path); fail("should have thrown exception"); } catch (JwtBundleException e) { assertEquals("Error adding authority of JWKS: keyID cannot be empty", e.getMessage()); } }
@Test void testLoadFile_InvalidKeyType_ThrowsKeyException() throws URISyntaxException, JwtBundleException { Path path = Paths.get(toUri("testdata/jwtbundle/jwks_invalid_keytype.json")); TrustDomain trustDomain = TrustDomain.of("domain.test"); try { JwtBundle.load(trustDomain, path); fail("should have thrown exception"); } catch (KeyException e) { assertEquals("Key Type not supported: OKP", e.getMessage()); } }
@Test void testLoadFile_NonExistentFile_ThrowsException() throws KeyException { Path path = Paths.get("testdata/jwtbundle/non-existen.json"); TrustDomain trustDomain = TrustDomain.of("domain.test"); try { JwtBundle.load(trustDomain, path); fail("should have thrown exception"); } catch (JwtBundleException e) { assertEquals("Could not load bundle from file: testdata/jwtbundle/non-existen.json", e.getMessage()); } }
@Test void testLoad_NullTrustDomain_ThrowsNullPointerException() throws KeyException, JwtBundleException { try { JwtBundle.load(null, Paths.get("path-to-file")); } catch (NullPointerException e) { assertEquals("trustDomain is marked non-null but is null", e.getMessage()); } }
@Test void testLoad_NullBundlePath_ThrowsNullPointerException() throws KeyException, JwtBundleException { try { JwtBundle.load(TrustDomain.of("example.org"), null); } catch (NullPointerException e) { assertEquals("bundlePath is marked non-null but is null", e.getMessage()); } }