File tree Expand file tree Collapse file tree 2 files changed +11
-10
lines changed
payment-service-paypal/src
main/java/com/example/paymentservicepaypal
test/java/com/example/paymentservicepaypal Expand file tree Collapse file tree 2 files changed +11
-10
lines changed Original file line number Diff line number Diff line change 66
77@ RestController
88@ RequestMapping ("/hello" )
9- public class TestController {
9+ public class PaymentController {
1010
1111 @ GetMapping
1212 public String sayHello () {
Original file line number Diff line number Diff line change 11package com .example .paymentservicepaypal ;
22
33import static org .springframework .test .web .servlet .request .MockMvcRequestBuilders .get ;
4+ import static org .springframework .test .web .servlet .result .MockMvcResultMatchers .content ;
45import static org .springframework .test .web .servlet .result .MockMvcResultMatchers .status ;
56
67import org .junit .jupiter .api .Test ;
78import org .springframework .beans .factory .annotation .Autowired ;
89import org .springframework .boot .test .autoconfigure .web .servlet .WebMvcTest ;
910import org .springframework .test .web .servlet .MockMvc ;
1011
11- @ WebMvcTest (TestController .class )
12+ @ WebMvcTest (PaymentController .class )
1213public class PaymentControllerTest {
13-
14- @ Autowired
15- private MockMvc mockMvc ;
1614
17- @ Test
18- void testGetPaymentStatus () throws Exception {
19- mockMvc .perform (get ("/api/payments/status" ))
20- .andExpect (status ().isOk ());
21- }
15+ @ Autowired
16+ private MockMvc mockMvc ;
17+
18+ @ Test
19+ void testSayHello () throws Exception {
20+ mockMvc .perform (get ("/hello" )).andExpect (status ().isOk ())
21+ .andExpect (content ().string ("hello from Paypal Payment Service" ));
22+ }
2223}
You can’t perform that action at this time.
0 commit comments