All Downloads are FREE. Search and download functionalities are using the official Maven repository.

entry-point.rest-webflux.api.unit.test.mustache Maven / Gradle / Ivy

Go to download

Gradle plugin to create a clean application in Java that already works, It follows our best practices!

There is a newer version: 3.20.10
Show newest version
package {{package}}.api;

import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest;
import org.springframework.http.MediaType;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.web.reactive.server.WebTestClient;

@ContextConfiguration(classes = {ApiRest.class})
@WebFluxTest
class ApiRestTest {

    @Autowired
    private WebTestClient webTestClient;

    @Test
    void testCommandName() {
        webTestClient.get()
                .uri("/api/path")
                .accept(MediaType.APPLICATION_JSON)
                .exchange()
                .expectStatus().isOk()
                .expectBody(String.class)
                .value(userResponse -> {
                            Assertions.assertThat(userResponse).isEmpty();
                        }
                );
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy