From: Kai Moritz Date: Tue, 14 Jan 2020 09:16:06 +0000 (+0100) Subject: WIP:mapping X-Git-Tag: wip-it~6 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=3724a4ff27ce25e5b6602aa8fffb063a8194c67f;p=demos%2Ftesting WIP:mapping --- diff --git a/src/test/java/de/juplo/demo/MappingIT.java b/src/test/java/de/juplo/demo/MappingIT.java new file mode 100644 index 0000000..58d18b8 --- /dev/null +++ b/src/test/java/de/juplo/demo/MappingIT.java @@ -0,0 +1,40 @@ +package de.juplo.demo; + + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import static org.mockito.ArgumentMatchers.any; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.test.context.junit.jupiter.SpringExtension; +import org.springframework.test.web.reactive.server.WebTestClient; +import reactor.core.publisher.Mono; +import static reactor.core.publisher.Mono.when; + + +/** + * Narrow Integration-Test for the mappings (URL -> controller). + * @author Kai Moritz + */ +@ExtendWith(SpringExtension.class) +@WebFluxTest() +public class MappingIT +{ + @Autowired + WebTestClient webClient; + @MockBean + RemoteContentService service; + + + @Test + void testHtmlController() + { + when(service.getRemoteText(any(String.class))).thenReturn(Mono.just("bar")); + webClient + .get() + .uri("/?path=foo") + .exchange() + .expectStatus().isOk(); + } +}