abahmanem commented on code in PR #8617: URL: https://github.com/apache/camel/pull/8617#discussion_r1003502435
########## components/camel-casper/src/test/java/org/apache/camel/component/casper/producer/CasperProducerWith_NETWORK_PEERS_OperationTest.java: ########## @@ -0,0 +1,50 @@ +package org.apache.camel.component.casper.producer; + +import static org.junit.jupiter.api.Assertions.assertTrue; +import java.util.List; + +import org.apache.camel.Exchange; +import org.apache.camel.Produce; +import org.apache.camel.ProducerTemplate; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.casper.CasperConstants; +import org.apache.camel.component.casper.CasperTestSupport; +import org.junit.jupiter.api.Test; + +import com.syntifi.casper.sdk.model.peer.PeerEntry; + +@SuppressWarnings("unchecked") +class CasperProducerWith_NETWORK_PEERS_OperationTest extends CasperTestSupport { + @Produce("direct:start") + protected ProducerTemplate template; + + @Override + public boolean isUseAdviceWith() { + return false; + } + + @Test + void testCall() throws Exception { + Exchange exchange = createExchangeWithBodyAndHeader(null, CasperConstants.OPERATION, CasperConstants.NETWORK_PEERS); + template.send(exchange); + Object body = exchange.getIn().getBody(); + // assert Object is a List + assertTrue(body instanceof List); + List<PeerEntry> peers = (List<PeerEntry>) (body); + assertTrue(!peers.isEmpty()); + // assert our List contains our node + //URI ourTestNode = new URI(CasperConstants.TESTNET_NODE_URL); + // assertTrue(peers.stream().anyMatch(s -> + // s.getAddress().substring(s.getAddress().indexOf(":")).equals(ourTestnode.getHost()))); Review Comment: fixed -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org