use of com.quorum.tessera.privacygroup.publish.PrivacyGroupPublisher in project tessera by ConsenSys.
the class BatchPrivacyGroupPublisherProviderTest method provider.
@Test
public void provider() {
PrivacyGroupPublisher privacyGroupPublisher = mock(PrivacyGroupPublisher.class);
BatchPrivacyGroupPublisher result;
try (var privacyGroupPublisherMockedStatic = mockStatic(PrivacyGroupPublisher.class)) {
privacyGroupPublisherMockedStatic.when(PrivacyGroupPublisher::create).thenReturn(privacyGroupPublisher);
result = BatchPrivacyGroupPublisherProvider.provider();
privacyGroupPublisherMockedStatic.verify(PrivacyGroupPublisher::create);
privacyGroupPublisherMockedStatic.verifyNoMoreInteractions();
}
assertThat(result).isNotNull();
verifyNoInteractions(privacyGroupPublisher);
}
use of com.quorum.tessera.privacygroup.publish.PrivacyGroupPublisher in project tessera by ConsenSys.
the class PrivacyGroupPublisherProviderTest method provider.
@Test
public void provider() throws Exception {
Config config = mock(Config.class);
when(config.getP2PServerConfig()).thenReturn(mock(ServerConfig.class));
ConfigFactory configFactory = mock(ConfigFactory.class);
when(configFactory.getConfig()).thenReturn(config);
PrivacyGroupPublisher result;
try (var discoveryMockedStatic = mockStatic(Discovery.class);
var configFactoryMockedStatic = mockStatic(ConfigFactory.class)) {
discoveryMockedStatic.when(Discovery::create).thenReturn(mock(Discovery.class));
configFactoryMockedStatic.when(ConfigFactory::create).thenReturn(configFactory);
result = PrivacyGroupPublisherProvider.provider();
discoveryMockedStatic.verify(Discovery::create);
configFactoryMockedStatic.verify(ConfigFactory::create);
discoveryMockedStatic.verifyNoMoreInteractions();
configFactoryMockedStatic.verifyNoMoreInteractions();
}
assertThat(result).isNotNull();
}
use of com.quorum.tessera.privacygroup.publish.PrivacyGroupPublisher in project tessera by ConsenSys.
the class PrivacyGroupPublisherTest method create.
@Test
public void create() {
PrivacyGroupPublisher privacyGroupPublisher = mock(PrivacyGroupPublisher.class);
ServiceLoader<PrivacyGroupPublisher> serviceLoader = mock(ServiceLoader.class);
when(serviceLoader.findFirst()).thenReturn(Optional.of(privacyGroupPublisher));
PrivacyGroupPublisher result;
try (var serviceLoaderMockedStatic = mockStatic(ServiceLoader.class)) {
serviceLoaderMockedStatic.when(() -> ServiceLoader.load(PrivacyGroupPublisher.class)).thenReturn(serviceLoader);
result = PrivacyGroupPublisher.create();
serviceLoaderMockedStatic.verify(() -> ServiceLoader.load(PrivacyGroupPublisher.class));
serviceLoaderMockedStatic.verifyNoMoreInteractions();
}
verify(serviceLoader).findFirst();
verifyNoMoreInteractions(serviceLoader);
assertThat(result).isNotNull().isSameAs(privacyGroupPublisher);
}
use of com.quorum.tessera.privacygroup.publish.PrivacyGroupPublisher in project tessera by ConsenSys.
the class BatchPrivacyGroupPublisherProvider method provider.
public static BatchPrivacyGroupPublisher provider() {
PrivacyGroupPublisher privacyGroupPublisher = PrivacyGroupPublisher.create();
ExecutorFactory executorFactory = new ExecutorFactory();
CancellableCountDownLatchFactory countDownLatchFactory = new CancellableCountDownLatchFactory();
return new AsyncBatchPrivacyGroupPublisher(executorFactory, countDownLatchFactory, privacyGroupPublisher);
}
Aggregations