use of io.micronaut.coherence.messaging.exceptions.CoherenceSubscriberException in project micronaut-coherence by micronaut-projects.
the class CoherenceSubscriberExceptionTest method testFourArgCauseCtor.
@Test
void testFourArgCauseCtor() {
Subscriber<?> subscriber = mock(Subscriber.class);
Subscriber.Element<?> element = mock(Subscriber.Element.class);
Throwable cause = new RuntimeException();
CoherenceSubscriberException exception = new CoherenceSubscriberException(cause, Integer.MAX_VALUE, subscriber, element);
assertThat(exception.getMessage(), nullValue());
assertThat(exception.getCause(), is(cause));
assertThat(exception.getKafkaListener(), is(Integer.MAX_VALUE));
assertThat(exception.getKafkaConsumer(), is(subscriber));
Optional<Subscriber.Element<?>> optElement = exception.getElement();
assertThat(optElement, notNullValue());
assertThat(optElement.orElseThrow(AssertionFailedError::new), is(element));
}
use of io.micronaut.coherence.messaging.exceptions.CoherenceSubscriberException in project micronaut-coherence by micronaut-projects.
the class CoherenceSubscriberExceptionTest method testFourArgMessageCtor.
@Test
void testFourArgMessageCtor() {
Subscriber<?> subscriber = mock(Subscriber.class);
Subscriber.Element<?> element = mock(Subscriber.Element.class);
CoherenceSubscriberException exception = new CoherenceSubscriberException("message", Integer.MAX_VALUE, subscriber, element);
assertThat(exception.getMessage(), is("message"));
assertThat(exception.getKafkaListener(), is(Integer.MAX_VALUE));
assertThat(exception.getKafkaConsumer(), is(subscriber));
Optional<Subscriber.Element<?>> optElement = exception.getElement();
assertThat(optElement, notNullValue());
assertThat(optElement.orElseThrow(AssertionFailedError::new), is(element));
}
use of io.micronaut.coherence.messaging.exceptions.CoherenceSubscriberException in project micronaut-coherence by micronaut-projects.
the class CoherenceSubscriberExceptionTest method testNullElementArg.
@Test
void testNullElementArg() {
Subscriber<?> subscriber = mock(Subscriber.class);
CoherenceSubscriberException exception = new CoherenceSubscriberException("message", Integer.MAX_VALUE, subscriber, null);
assertThat(exception.getMessage(), is("message"));
assertThat(exception.getKafkaListener(), is(Integer.MAX_VALUE));
assertThat(exception.getKafkaConsumer(), is(subscriber));
Optional<Subscriber.Element<?>> optElement = exception.getElement();
assertThat(optElement, notNullValue());
assertThat(optElement.isPresent(), is(false));
}
use of io.micronaut.coherence.messaging.exceptions.CoherenceSubscriberException in project micronaut-coherence by micronaut-projects.
the class CoherenceSubscriberExceptionTest method testFiveArgCtor.
@Test
void testFiveArgCtor() {
Subscriber<?> subscriber = mock(Subscriber.class);
Subscriber.Element<?> element = mock(Subscriber.Element.class);
Throwable cause = new RuntimeException();
CoherenceSubscriberException exception = new CoherenceSubscriberException("message", cause, Integer.MAX_VALUE, subscriber, element);
assertThat(exception.getMessage(), is("message"));
assertThat(exception.getCause(), is(cause));
assertThat(exception.getKafkaListener(), is(Integer.MAX_VALUE));
assertThat(exception.getKafkaConsumer(), is(subscriber));
Optional<Subscriber.Element<?>> optElement = exception.getElement();
assertThat(optElement, notNullValue());
assertThat(optElement.orElseThrow(AssertionFailedError::new), is(element));
}
Aggregations