Test for default function defined on interface
-
package com.quorum.tessera.nacl;
import com.quorum.tessera.encryption.KeyPair;
@@ -11,18 +10,15 @@ import org.junit.Before;
import org.junit.Test;
import static org.mockito.Mockito.mock;
-
public class NaclFacadeTest {
private NaclFacade naclFacade;
-
@Before
public void onSetUp() {
naclFacade = new MockNaclFacade();
}
-
@Test
public void sealAfterPrecomputationWithMasterKey() {
byte[] message = "MESSAGE".getBytes();
@@ -36,6 +32,19 @@ public class NaclFacadeTest {
assertThat(result).isEqualTo(outcome);
}
+ @Test
+ public void openAfterPrecomputationWithMasterKey() {
+ byte[] message = "MESSAGE".getBytes();
+ Nonce nonce = mock(Nonce.class);
+ MasterKey masterKey = mock(MasterKey.class);
+
+ byte[] outcome = "openAfterPrecomputationWithSharedKey".getBytes();
+
+ byte[] result = naclFacade.openAfterPrecomputation(message, nonce, masterKey);
+
+ assertThat(result).isEqualTo(outcome);
+ }
+
@Test
public void createMasterKey() {
@@ -67,7 +76,7 @@ public class NaclFacadeTest {
@Override
public byte[] openAfterPrecomputation(byte[] cipherText, Nonce nonce, SharedKey sharedKey) {
- throw new UnsupportedOperationException("Not supported yet.");
+ return "openAfterPrecomputationWithSharedKey".getBytes();
}
@Override
@@ -87,5 +96,4 @@ public class NaclFacadeTest {
}
-
}
