use of com.quorum.tessera.transaction.publish.PayloadPublisher in project tessera by ConsenSys.
the class LegacyResendManagerProviderTest method provider.
@Test
public void provider() {
try (var enclaveMockedStatic = mockStatic(Enclave.class);
var encryptedTransactionDAOMockedStatic = mockStatic(EncryptedTransactionDAO.class);
var payloadPublisherMockedStatic = mockStatic(PayloadPublisher.class);
var discoveryMockedStatic = mockStatic(Discovery.class)) {
enclaveMockedStatic.when(Enclave::create).thenReturn(mock(Enclave.class));
encryptedTransactionDAOMockedStatic.when(EncryptedTransactionDAO::create).thenReturn(mock(EncryptedTransactionDAO.class));
payloadPublisherMockedStatic.when(PayloadPublisher::create).thenReturn(mock(PayloadPublisher.class));
discoveryMockedStatic.when(Discovery::create).thenReturn(mock(Discovery.class));
LegacyResendManager legacyResendManager = LegacyResendManagerProvider.provider();
assertThat(legacyResendManager).isNotNull();
enclaveMockedStatic.verify(Enclave::create);
enclaveMockedStatic.verifyNoMoreInteractions();
encryptedTransactionDAOMockedStatic.verify(EncryptedTransactionDAO::create);
encryptedTransactionDAOMockedStatic.verifyNoMoreInteractions();
payloadPublisherMockedStatic.verify(PayloadPublisher::create);
discoveryMockedStatic.verify(Discovery::create);
discoveryMockedStatic.verifyNoMoreInteractions();
}
}
use of com.quorum.tessera.transaction.publish.PayloadPublisher in project tessera by ConsenSys.
the class PayloadPublisherProviderTest method provider.
@Test
public void provider() {
ConfigFactory configFactory = mock(ConfigFactory.class);
Config config = mock(Config.class);
ServerConfig serverConfig = mock(ServerConfig.class);
when(config.getP2PServerConfig()).thenReturn(serverConfig);
when(configFactory.getConfig()).thenReturn(config);
try (var configFactoryMockedStatic = mockStatic(ConfigFactory.class);
var discoveryMockedStatic = mockStatic(Discovery.class)) {
configFactoryMockedStatic.when(ConfigFactory::create).thenReturn(configFactory);
discoveryMockedStatic.when(Discovery::create).thenReturn(mock(Discovery.class));
PayloadPublisher payloadPublisher = PayloadPublisherProvider.provider();
assertThat(payloadPublisher).isNotNull();
configFactoryMockedStatic.verify(ConfigFactory::create);
configFactoryMockedStatic.verifyNoMoreInteractions();
discoveryMockedStatic.verify(Discovery::create);
discoveryMockedStatic.verifyNoMoreInteractions();
}
}
Aggregations