use of com.ecwid.consul.v1.OperationException in project spring-cloud-consul by spring-cloud.
the class ConsulDiscoveryClientProbeTests method probeFails.
@Test
public void probeFails() {
when(consulClient.getStatusLeader()).thenThrow(new OperationException(5150, "5150", "No leader"));
assertThatThrownBy(() -> discoveryClient.probe()).isInstanceOf(OperationException.class).hasMessageContaining("No leader");
verify(consulClient).getStatusLeader();
}
use of com.ecwid.consul.v1.OperationException in project spring-cloud-consul by spring-cloud.
the class ConsulInboundMessageProducerTests method getEventsShouldNotThrowException.
@Test
public void getEventsShouldNotThrowException() {
EventService eventService = mock(EventService.class);
when(eventService.watch()).thenThrow(new OperationException(500, "error", ""));
ConsulInboundMessageProducer producer = new ConsulInboundMessageProducer(eventService);
try {
producer.getEvents();
} catch (Exception e) {
fail("ConsulInboundMessageProducer threw unexpected exception: " + e);
}
}
Aggregations