|
| 1 | +package org.reactivecommons.async.kafka; |
| 2 | + |
| 3 | +import io.cloudevents.CloudEvent; |
| 4 | +import org.junit.jupiter.api.Test; |
| 5 | +import org.junit.jupiter.api.extension.ExtendWith; |
| 6 | +import org.mockito.Mock; |
| 7 | +import org.mockito.junit.jupiter.MockitoExtension; |
| 8 | +import org.reactivecommons.api.domain.Command; |
| 9 | +import org.reactivecommons.async.api.AsyncQuery; |
| 10 | +import org.reactivecommons.async.api.DirectAsyncGateway; |
| 11 | +import org.reactivecommons.async.api.From; |
| 12 | + |
| 13 | +import static org.junit.jupiter.api.Assertions.assertThrows; |
| 14 | + |
| 15 | +@ExtendWith(MockitoExtension.class) |
| 16 | +class KafkaDirectAsyncGatewayTest { |
| 17 | + private final DirectAsyncGateway directAsyncGateway = new KafkaDirectAsyncGateway(); |
| 18 | + private final String targetName = "targetName"; |
| 19 | + private final String domain = "domain"; |
| 20 | + private final long delay = 1000L; |
| 21 | + @Mock |
| 22 | + private CloudEvent cloudEvent; |
| 23 | + @Mock |
| 24 | + private Command<String> command; |
| 25 | + @Mock |
| 26 | + private AsyncQuery<String> query; |
| 27 | + @Mock |
| 28 | + private From from; |
| 29 | + |
| 30 | + @Test |
| 31 | + void allMethodsAreNotImplemented() { |
| 32 | + assertThrows(UnsupportedOperationException.class, () -> directAsyncGateway.sendCommand(cloudEvent, targetName)); |
| 33 | + assertThrows(UnsupportedOperationException.class, () -> directAsyncGateway.sendCommand(cloudEvent, targetName, domain)); |
| 34 | + assertThrows(UnsupportedOperationException.class, () -> directAsyncGateway.sendCommand(cloudEvent, targetName, delay)); |
| 35 | + assertThrows(UnsupportedOperationException.class, () -> directAsyncGateway.sendCommand(cloudEvent, targetName, delay, domain)); |
| 36 | + assertThrows(UnsupportedOperationException.class, () -> directAsyncGateway.sendCommand(command, targetName)); |
| 37 | + assertThrows(UnsupportedOperationException.class, () -> directAsyncGateway.sendCommand(command, targetName, domain)); |
| 38 | + assertThrows(UnsupportedOperationException.class, () -> directAsyncGateway.sendCommand(command, targetName, delay)); |
| 39 | + assertThrows(UnsupportedOperationException.class, () -> directAsyncGateway.sendCommand(command, targetName, delay, domain)); |
| 40 | + |
| 41 | + assertThrows(UnsupportedOperationException.class, () -> directAsyncGateway.requestReply(cloudEvent, targetName, CloudEvent.class)); |
| 42 | + assertThrows(UnsupportedOperationException.class, () -> directAsyncGateway.requestReply(cloudEvent, targetName, CloudEvent.class, domain)); |
| 43 | + assertThrows(UnsupportedOperationException.class, () -> directAsyncGateway.requestReply(query, targetName, CloudEvent.class)); |
| 44 | + assertThrows(UnsupportedOperationException.class, () -> directAsyncGateway.requestReply(query, targetName, CloudEvent.class, domain)); |
| 45 | + |
| 46 | + assertThrows(UnsupportedOperationException.class, () -> directAsyncGateway.reply(targetName, from)); |
| 47 | + } |
| 48 | +} |
0 commit comments