use of org.hyperledger.besu.ethereum.api.jsonrpc.websocket.subscription.logs.LogsSubscription in project besu by hyperledger.
the class SubscriptionBuilderTest method shouldThrownIllegalArgumentExceptionWhenMappingWrongSubscriptionType.
@Test
@SuppressWarnings("ReturnValueIgnored")
public void shouldThrownIllegalArgumentExceptionWhenMappingWrongSubscriptionType() {
final Function<Subscription, LogsSubscription> function = subscriptionBuilder.mapToSubscriptionClass(LogsSubscription.class);
final NewBlockHeadersSubscription subscription = new NewBlockHeadersSubscription(1L, CONNECTION_ID, true);
final Throwable thrown = catchThrowable(() -> function.apply(subscription));
assertThat(thrown).hasNoCause().isInstanceOf(IllegalArgumentException.class).hasMessage("NewBlockHeadersSubscription instance can't be mapped to type LogsSubscription");
}
use of org.hyperledger.besu.ethereum.api.jsonrpc.websocket.subscription.logs.LogsSubscription in project besu by hyperledger.
the class SubscriptionBuilderTest method shouldReturnSubscriptionWhenMappingNewPendingTransactionsSubscription.
@Test
public void shouldReturnSubscriptionWhenMappingNewPendingTransactionsSubscription() {
final Function<Subscription, Subscription> function = subscriptionBuilder.mapToSubscriptionClass(Subscription.class);
final Subscription logsSubscription = new Subscription(1L, CONNECTION_ID, SubscriptionType.NEW_PENDING_TRANSACTIONS, Boolean.FALSE);
assertThat(function.apply(logsSubscription)).isInstanceOf(Subscription.class);
}
use of org.hyperledger.besu.ethereum.api.jsonrpc.websocket.subscription.logs.LogsSubscription in project besu by hyperledger.
the class SubscriptionBuilderTest method shouldBuildLogsSubscriptionWhenSubscribeRequestTypeIsLogs.
@Test
public void shouldBuildLogsSubscriptionWhenSubscribeRequestTypeIsLogs() {
final FilterParameter filterParameter = filterParameter();
final SubscribeRequest subscribeRequest = new SubscribeRequest(SubscriptionType.LOGS, filterParameter, null, CONNECTION_ID);
final LogsSubscription expectedSubscription = new LogsSubscription(1L, CONNECTION_ID, filterParameter);
final Subscription builtSubscription = subscriptionBuilder.build(1L, CONNECTION_ID, subscribeRequest);
assertThat(builtSubscription).usingRecursiveComparison().isEqualTo(expectedSubscription);
}
use of org.hyperledger.besu.ethereum.api.jsonrpc.websocket.subscription.logs.LogsSubscription in project besu by hyperledger.
the class SubscriptionBuilderTest method shouldReturnLogsSubscriptionWhenMappingLogsSubscription.
@Test
public void shouldReturnLogsSubscriptionWhenMappingLogsSubscription() {
final Function<Subscription, LogsSubscription> function = subscriptionBuilder.mapToSubscriptionClass(LogsSubscription.class);
final Subscription subscription = new LogsSubscription(1L, CONNECTION_ID, filterParameter());
assertThat(function.apply(subscription)).isInstanceOf(LogsSubscription.class);
}
Aggregations