Как написать JUnit для следующей операции Spring Integration DSL Http.outboundGateway:
integrationFlowBuilder
.from(integerMessageSource(),
c -> c.poller(Pollers.cron("0 0/1 * 1/1 * ?")
.handle(Http
.outboundGateway("http://localhost:8050/greeting")
.httpMethod(HttpMethod.GET)
.expectedResponseType(String.class))
.channel("getChannel");
flowContext.registration(integrationFlowBuilder.get()).register();
Метод integerMessageSource - это
@Bean
private MethodInvokingMessageSource integerMessageSource() {
final MethodInvokingMessageSource source = new MethodInvokingMessageSource();
source.setObject(new AtomicInteger());
source.setMethodName("getAndIncrement");
return source;
}
Я хочу запустить JUnit с некоторым выражением cron и убедиться, что URL-адрес "http://localhost:8050/greeting "называется. Было бы хорошо, если бы сервер в URL-адресе http://localhost:8050/greeting был имитирован, чтобы он отвечает некоторым ответом.
С помощью операции POST я хочу проверить, что часть JSON отправляется по URL-адресу http://localhost:8050/greeting.
Можно ли это проверить?