File tree Expand file tree Collapse file tree 4 files changed +44
-1
lines changed
payment-service-paypal/src
main/java/com/example/paymentservicepaypal
test/java/com/example/paymentservicepaypal Expand file tree Collapse file tree 4 files changed +44
-1
lines changed Original file line number Diff line number Diff line change 4949 <img src =" https://sonarcloud.io/api/project_badges/measure?project=vijayagopalsb_spring-dynamic-microservices&metric=security_rating " alt =" Security " />
5050</a >
5151
52-
52+ <a href =" https://sonarcloud.io/summary/overall?id=vijayagopalsb_spring-dynamic-microservices " >
53+ <img src =" https://sonarcloud.io/api/project_badges/measure?project=vijayagopalsb_spring-dynamic-microservices&metric=coverage " alt =" Coverage Badge " />
54+ </a >
5355
5456</p >
5557
Original file line number Diff line number Diff line change 1+ package com .example .paymentservicepaypal ;
2+ public class PaymentService {
3+ public String process () {
4+ return "Success" ;
5+ }
6+ }
Original file line number Diff line number Diff line change 1+ package com .example .paymentservicepaypal ;
2+
3+ import static org .springframework .test .web .servlet .request .MockMvcRequestBuilders .get ;
4+ import static org .springframework .test .web .servlet .result .MockMvcResultMatchers .status ;
5+
6+ import org .junit .jupiter .api .Test ;
7+ import org .springframework .beans .factory .annotation .Autowired ;
8+ import org .springframework .boot .test .autoconfigure .web .servlet .WebMvcTest ;
9+ import org .springframework .test .web .servlet .MockMvc ;
10+
11+ @ WebMvcTest (TestController .class )
12+ public class PaymentControllerTest {
13+
14+ @ Autowired
15+ private MockMvc mockMvc ;
16+
17+ @ Test
18+ void testGetPaymentStatus () throws Exception {
19+ mockMvc .perform (get ("/api/payments/status" ))
20+ .andExpect (status ().isOk ());
21+ }
22+ }
Original file line number Diff line number Diff line change 1+ package com .example .paymentservicepaypal ;
2+
3+ import static org .junit .jupiter .api .Assertions .assertEquals ;
4+
5+ import org .junit .jupiter .api .Test ;
6+
7+ class PaymentServiceTest {
8+ @ Test
9+ void shouldReturnSuccess () {
10+ PaymentService service = new PaymentService ();
11+ assertEquals ("Success" , service .process ());
12+ }
13+ }
You can’t perform that action at this time.
0 commit comments