### Question:
Hkdf { static byte[] hkdf(byte[] masterKey, byte[] salt, byte[] data) throws InvalidKeyException { checkNotNull(masterKey, "HKDF requires master key to be set."); checkNotNull(salt, "HKDF requires a salt."); checkNotNull(data, "No data provided to HKDF."); return hkdfSha256Expand(hkdfSha256Extract(masterKey, salt), data); } private  Hkdf();   }### Answer:
@Test public void hkdf_derivesKeyMaterial() throws Exception { byte[] result = Hkdf.hkdf(HKDF_CASE1_IKM, HKDF_CASE1_SALT, HKDF_CASE1_INFO); assertThat(result).isEqualTo(HKDF_CASE1_OKM); }
@Test public void hkdf_withNullKey_throwsNullPointerException() throws Exception { assertThrows( NullPointerException.class, () -> Hkdf.hkdf(null, HKDF_CASE1_SALT, HKDF_CASE1_INFO)); }
@Test public void hkdf_withNullSalt_throwsNullPointerException() throws Exception { assertThrows( NullPointerException.class, () -> Hkdf.hkdf(HKDF_CASE1_IKM, null, HKDF_CASE1_INFO)); }
@Test public void hkdf_withNullData_throwsNullPointerException() throws Exception { assertThrows( NullPointerException.class, () -> Hkdf.hkdf(HKDF_CASE1_IKM, HKDF_CASE1_SALT, null)); }