Search in sources :

Example 1 with CoherenceSubscriberException

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));
}
Also used : CoherenceSubscriberException(io.micronaut.coherence.messaging.exceptions.CoherenceSubscriberException) Subscriber(com.tangosol.net.topic.Subscriber) Test(org.junit.jupiter.api.Test)

Example 2 with CoherenceSubscriberException

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));
}
Also used : CoherenceSubscriberException(io.micronaut.coherence.messaging.exceptions.CoherenceSubscriberException) Subscriber(com.tangosol.net.topic.Subscriber) Test(org.junit.jupiter.api.Test)

Example 3 with CoherenceSubscriberException

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));
}
Also used : CoherenceSubscriberException(io.micronaut.coherence.messaging.exceptions.CoherenceSubscriberException) Test(org.junit.jupiter.api.Test)

Example 4 with CoherenceSubscriberException

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));
}
Also used : CoherenceSubscriberException(io.micronaut.coherence.messaging.exceptions.CoherenceSubscriberException) Subscriber(com.tangosol.net.topic.Subscriber) Test(org.junit.jupiter.api.Test)

Aggregations

CoherenceSubscriberException (io.micronaut.coherence.messaging.exceptions.CoherenceSubscriberException)4 Test (org.junit.jupiter.api.Test)4 Subscriber (com.tangosol.net.topic.Subscriber)3