Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6a9ee99

Browse files
committed
Create test class for testing mvc controller.
1 parent e840a2d commit 6a9ee99

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.nihat.springwebfluxdemo.controllers.mvc;
2+
3+
import com.nihat.springwebfluxdemo.model.ProductDTO;
4+
import com.nihat.springwebfluxdemo.services.ProductService;
5+
import org.junit.jupiter.api.MethodOrderer;
6+
import org.junit.jupiter.api.TestMethodOrder;
7+
import org.springframework.beans.factory.annotation.Autowired;
8+
import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient;
9+
import org.springframework.boot.test.context.SpringBootTest;
10+
import org.springframework.test.web.reactive.server.WebTestClient;
11+
12+
import static org.junit.jupiter.api.Assertions.*;
13+
14+
@SpringBootTest
15+
@AutoConfigureWebTestClient
16+
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
17+
class ProductControllerTest {
18+
19+
@Autowired
20+
WebTestClient webTestClient;
21+
22+
@Autowired
23+
ProductService productService;
24+
25+
26+
private ProductDTO getSavedTestProduct() {
27+
return productService.getAllProducts().next().block();
28+
}
29+
30+
31+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /