Search in sources :

Example 1 with DiscoveryHelper

use of com.quorum.tessera.discovery.DiscoveryHelper 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);
    }
}
Also used : Enclave(com.quorum.tessera.enclave.Enclave) DiscoveryHelper(com.quorum.tessera.discovery.DiscoveryHelper) NetworkStore(com.quorum.tessera.discovery.NetworkStore) Test(org.junit.Test)

Aggregations

DiscoveryHelper (com.quorum.tessera.discovery.DiscoveryHelper)1 NetworkStore (com.quorum.tessera.discovery.NetworkStore)1 Enclave (com.quorum.tessera.enclave.Enclave)1 Test (org.junit.Test)1