use of com.quorum.tessera.enclave.Enclave in project tessera by ConsenSys.
the class DiscoveryHelperProviderTest method provider.
@Test
public void provider() {
try (var mockedEnclave = mockStatic(Enclave.class);
var mockedNetworkStore = mockStatic(NetworkStore.class)) {
NetworkStore networkStore = mock(NetworkStore.class);
mockedNetworkStore.when(NetworkStore::getInstance).thenReturn(networkStore);
Enclave enclave = mock(Enclave.class);
mockedEnclave.when(Enclave::create).thenReturn(enclave);
DiscoveryHelper helper = DiscoveryHelperProvider.provider();
assertThat(helper).isNotNull().isExactlyInstanceOf(DiscoveryHelperImpl.class);
mockedEnclave.verify(Enclave::create);
mockedEnclave.verifyNoMoreInteractions();
mockedNetworkStore.verify(NetworkStore::getInstance);
mockedNetworkStore.verifyNoMoreInteractions();
verifyNoInteractions(networkStore);
verifyNoInteractions(enclave);
}
}
use of com.quorum.tessera.enclave.Enclave in project tessera by ConsenSys.
the class DiscoveryHelperTest method create.
@Test
public void create() {
try (var staticEnclave = mockStatic(Enclave.class)) {
Enclave enclave = mock(Enclave.class);
staticEnclave.when(Enclave::create).thenReturn(enclave);
DiscoveryHelper.create();
staticEnclave.verify(Enclave::create);
verifyNoInteractions(enclave);
staticEnclave.verifyNoMoreInteractions();
}
}
use of com.quorum.tessera.enclave.Enclave in project tessera by ConsenSys.
the class EnclaveKeySynchroniserProviderTest method provider.
@Test
public void provider() {
try (var mockedEnclave = mockStatic(Enclave.class);
var mockedNetworkStore = mockStatic(NetworkStore.class)) {
NetworkStore networkStore = mock(NetworkStore.class);
mockedNetworkStore.when(NetworkStore::getInstance).thenReturn(networkStore);
Enclave enclave = mock(Enclave.class);
mockedEnclave.when(Enclave::create).thenReturn(enclave);
EnclaveKeySynchroniser enclaveKeySynchroniser = EnclaveKeySynchroniserProvider.provider();
assertThat(enclaveKeySynchroniser).isNotNull().isExactlyInstanceOf(EnclaveKeySynchroniserImpl.class);
mockedEnclave.verify(Enclave::create);
mockedEnclave.verifyNoMoreInteractions();
mockedNetworkStore.verify(NetworkStore::getInstance);
mockedNetworkStore.verifyNoMoreInteractions();
verifyNoInteractions(networkStore);
verifyNoInteractions(enclave);
}
}
use of com.quorum.tessera.enclave.Enclave in project tessera by ConsenSys.
the class ResendManagerProviderTest method provider.
@Test
public void provider() {
try (var mockedEncryptedTransactionDAO = mockStatic(EncryptedTransactionDAO.class);
var mockedEnclave = mockStatic(Enclave.class);
var mockedStaticPayloadDigest = mockStatic(PayloadDigest.class)) {
Enclave enclave = mock(Enclave.class);
mockedEnclave.when(Enclave::create).thenReturn(enclave);
mockedEncryptedTransactionDAO.when(EncryptedTransactionDAO::create).thenReturn(mock(EncryptedTransactionDAO.class));
mockedStaticPayloadDigest.when(PayloadDigest::create).thenReturn(mock(PayloadDigest.class));
ResendManager resendManager = ResendManagerProvider.provider();
assertThat(resendManager).isNotNull();
mockedEncryptedTransactionDAO.verify(EncryptedTransactionDAO::create);
mockedEncryptedTransactionDAO.verifyNoMoreInteractions();
mockedEnclave.verify(Enclave::create);
mockedEnclave.verifyNoMoreInteractions();
mockedStaticPayloadDigest.verify(PayloadDigest::create);
mockedStaticPayloadDigest.verifyNoMoreInteractions();
}
}
use of com.quorum.tessera.enclave.Enclave in project tessera by ConsenSys.
the class EncodedPayloadManagerProviderTest method provider.
@Test
public void provider() {
try (var mockedEnclaveFactory = mockStatic(Enclave.class);
var mockedPrivacyHelper = mockStatic(PrivacyHelper.class);
var mockedPayloadDigest = mockStatic(PayloadDigest.class)) {
mockedPayloadDigest.when(PayloadDigest::create).thenReturn(mock(PayloadDigest.class));
mockedPrivacyHelper.when(PrivacyHelper::create).thenReturn(mock(PrivacyHelper.class));
mockedEnclaveFactory.when(Enclave::create).thenReturn(mock(Enclave.class));
EncodedPayloadManager encodedPayloadManager = EncodedPayloadManagerProvider.provider();
assertThat(encodedPayloadManager).isNotNull();
assertThat(encodedPayloadManager).describedAs("Subsequent invocations should return the same instance").isSameAs(EncodedPayloadManagerProvider.provider());
mockedPrivacyHelper.verify(PrivacyHelper::create);
mockedPrivacyHelper.verifyNoMoreInteractions();
mockedEnclaveFactory.verify(Enclave::create);
mockedEnclaveFactory.verifyNoMoreInteractions();
mockedPayloadDigest.verify(PayloadDigest::create);
mockedPayloadDigest.verifyNoMoreInteractions();
}
}
Aggregations