use of com.quorum.tessera.privacygroup.publish.BatchPrivacyGroupPublisher 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.BatchPrivacyGroupPublisher in project tessera by ConsenSys.
the class PrivacyGroupManagerProviderTest method provider.
@Test
public void provider() {
try (var enclaveMockedStatic = mockStatic(Enclave.class);
var privacyGroupDAOMockStatic = mockStatic(PrivacyGroupDAO.class);
var batchPrivacyGroupPublisherMockedStatic = mockStatic(BatchPrivacyGroupPublisher.class)) {
enclaveMockedStatic.when(Enclave::create).thenReturn(mock(Enclave.class));
privacyGroupDAOMockStatic.when(PrivacyGroupDAO::create).thenReturn(mock(PrivacyGroupDAO.class));
batchPrivacyGroupPublisherMockedStatic.when(BatchPrivacyGroupPublisher::create).thenReturn(mock(BatchPrivacyGroupPublisher.class));
PrivacyGroupManager result = PrivacyGroupManagerProvider.provider();
assertThat(result).isNotNull();
enclaveMockedStatic.verify(Enclave::create);
enclaveMockedStatic.verifyNoMoreInteractions();
privacyGroupDAOMockStatic.verify(PrivacyGroupDAO::create);
privacyGroupDAOMockStatic.verifyNoMoreInteractions();
batchPrivacyGroupPublisherMockedStatic.verify(BatchPrivacyGroupPublisher::create);
batchPrivacyGroupPublisherMockedStatic.verifyNoMoreInteractions();
}
}
use of com.quorum.tessera.privacygroup.publish.BatchPrivacyGroupPublisher in project tessera by ConsenSys.
the class BatchPrivacyGroupPublisherTest method create.
@Test
public void create() {
BatchPrivacyGroupPublisher privacyGroupPublisher = mock(BatchPrivacyGroupPublisher.class);
ServiceLoader<BatchPrivacyGroupPublisher> serviceLoader = mock(ServiceLoader.class);
when(serviceLoader.findFirst()).thenReturn(Optional.of(privacyGroupPublisher));
BatchPrivacyGroupPublisher result;
try (var serviceLoaderMockedStatic = mockStatic(ServiceLoader.class)) {
serviceLoaderMockedStatic.when(() -> ServiceLoader.load(BatchPrivacyGroupPublisher.class)).thenReturn(serviceLoader);
result = BatchPrivacyGroupPublisher.create();
serviceLoaderMockedStatic.verify(() -> ServiceLoader.load(BatchPrivacyGroupPublisher.class));
serviceLoaderMockedStatic.verifyNoMoreInteractions();
}
verify(serviceLoader).findFirst();
verifyNoMoreInteractions(serviceLoader);
assertThat(result).isNotNull().isSameAs(privacyGroupPublisher);
}
use of com.quorum.tessera.privacygroup.publish.BatchPrivacyGroupPublisher in project tessera by ConsenSys.
the class PrivacyGroupManagerProvider method provider.
public static PrivacyGroupManager provider() {
Enclave enclave = Enclave.create();
PrivacyGroupDAO privacyGroupDAO = PrivacyGroupDAO.create();
BatchPrivacyGroupPublisher publisher = BatchPrivacyGroupPublisher.create();
return new PrivacyGroupManagerImpl(enclave, privacyGroupDAO, publisher);
}
use of com.quorum.tessera.privacygroup.publish.BatchPrivacyGroupPublisher 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