### Question:
Jwk { @SuppressWarnings("unchecked") public static Jwk fromValues(Map<String, Object> map) { Map<String, Object> values = new HashMap<>(map); String kid = (String) values.remove("kid"); String kty = (String) values.remove("kty"); String alg = (String) values.remove("alg"); String use = (String) values.remove("use"); Object keyOps = values.remove("key_ops"); String x5u = (String) values.remove("x5u"); List<String> x5c = (List<String>) values.remove("x5c"); String x5t = (String) values.remove("x5t"); if (kty == null) { throw new IllegalArgumentException("Attributes " + map + " are not from a valid jwk"); } if (keyOps instanceof String) { return new Jwk(kid, kty, alg, use, (String) keyOps, x5u, x5c, x5t, values); } else { return new Jwk(kid, kty, alg, use, (List<String>) keyOps, x5u, x5c, x5t, values); } } Jwk(String id, String type, String algorithm, String usage, List<String> operations, String certificateUrl, List<String> certificateChain, String certificateThumbprint, Map<String, Object> additionalAttributes); @Deprecated  Jwk(String id, String type, String algorithm, String usage, String operations, String certificateUrl, List<String> certificateChain, String certificateThumbprint, Map<String, Object> additionalAttributes); @SuppressWarnings("unchecked") static Jwk fromValues(Map<String, Object> map); String getId(); String getType(); String getAlgorithm(); String getUsage(); String getOperations(); List<String> getOperationsAsList(); String getCertificateUrl(); List<String> getCertificateChain(); String getCertificateThumbprint(); Map<String, Object> getAdditionalAttributes(); RSAPublicKey getRsaPublicKey(); @Override String toString();  }### Answer:
@Test public void shouldNotThrowInvalidArgumentExceptionOnMissingKidParam() throws Exception { final String kid = randomKeyId(); Map<String, Object> values = publicKeyValues(kid, KEY_OPS_LIST); values.remove("kid"); Jwk.fromValues(values); }
@Test public void shouldThrowInvalidArgumentExceptionOnMissingKtyParam() throws Exception { final String kid = randomKeyId(); Map<String, Object> values = publicKeyValues(kid, KEY_OPS_LIST); values.remove("kty"); expectedException.expect(IllegalArgumentException.class); Jwk.fromValues(values); }