BAEL-2304 Improve webflux original article

- Added snippets for spring reactive functional tutorial
This commit is contained in:
Dhawal Kapil
2018-09-04 22:36:54 +05:30
parent 22db7b8c92
commit 5f0cc2716e
3 changed files with 116 additions and 0 deletions
@@ -0,0 +1,28 @@
package com.baeldung.reactive.functional;
import org.junit.Test;
import org.springframework.test.web.reactive.server.WebTestClient;
import com.baeldung.webflux.Employee;
public class EmployeeSpringFunctionalIntegrationTest {
private static EmployeeFunctionalConfig config = new EmployeeFunctionalConfig();
@Test
public void givenEmployeeId_whenGetEmployeeById_thenCorrectEmployee() {
WebTestClient client = WebTestClient
.bindToRouterFunction(config.getEmployeeByIdRoute())
.build();
Employee expected = new Employee("1", "Employee 1");
client.get()
.uri("/employees/1")
.exchange()
.expectStatus()
.isOk()
.expectBody(Employee.class)
.isEqualTo(expected);
}
}