### Question:
MultiTenancyUserUtil { public static Optional<String> enclavePublicKey(final Optional<User> user) { return user.map(u -> u.principal().getString(ENCLAVE_PRIVACY_PUBLIC_KEY_CLAIM)); }  static Optional<String> enclavePublicKey(final Optional<User> user);  }### Answer:
@Test public void noEnclavePublicKeyWhenNoUserProvided() { assertThat(enclavePublicKey(empty())).isEmpty(); }
@Test public void noEnclavePublicKeyWhenUserWithoutEnclavePublicKeyClaimProvided() { final JsonObject token = new JsonObject(); final Optional<User> user = Optional.of(new JWTUser(token, "")); assertThat(enclavePublicKey(user)).isEmpty(); }
@Test public void enclavePublicKeyKeyReturnedForUserWithEnclavePublicKeyClaim() { final JsonObject principle = new JsonObject(); principle.put("privacyPublicKey", "ABC123"); final Optional<User> user = Optional.of(new JWTUser(principle, "")); assertThat(enclavePublicKey(user)).contains("ABC123"); }