Search in sources :

Example 1 with DummyAead

use of com.google.crypto.tink.testing.TestUtil.DummyAead in project tink by google.

the class AeadOrDaeadTest method testWithAeadPrimitive.

@Test
public void testWithAeadPrimitive() {
    AeadOrDaead aeadOrDaead = new AeadOrDaead(new DummyAead());
    // Test that encrypt and decrypt is called on the DummyAead.
    GeneralSecurityException thrown = assertThrows(GeneralSecurityException.class, () -> aeadOrDaead.encrypt(TEST_BYTE_VECTOR, TEST_BYTE_VECTOR));
    assertThat(thrown).hasMessageThat().contains("dummy");
    thrown = assertThrows(GeneralSecurityException.class, () -> aeadOrDaead.decrypt(TEST_BYTE_VECTOR, TEST_BYTE_VECTOR));
    assertThat(thrown).hasMessageThat().contains("dummy");
}
Also used : GeneralSecurityException(java.security.GeneralSecurityException) DummyAead(com.google.crypto.tink.testing.TestUtil.DummyAead) Test(org.junit.Test)

Aggregations

DummyAead (com.google.crypto.tink.testing.TestUtil.DummyAead)1 GeneralSecurityException (java.security.GeneralSecurityException)1 Test (org.junit.Test)1