diff --git a/src/test/java/com/example/springdemo/ControllerTests.java b/src/test/java/com/example/springdemo/ControllerTests.java new file mode 100644 index 0000000..65a9724 --- /dev/null +++ b/src/test/java/com/example/springdemo/ControllerTests.java @@ -0,0 +1,44 @@ +package com.example.springdemo; + +import com.example.springdemo.controller.MerchantsController; +import com.example.springdemo.controller.UsersController; +import com.example.springdemo.service.MerchantsService; +import com.example.springdemo.service.UsersService; +import jakarta.annotation.Resource; +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.test.mock.mockito.MockBean; + +@WebMvcTest(UsersController.class) +class UsersControllerTests { + @Resource + private UsersController usersController; + + @MockBean + private UsersService usersService; + + @Test + public void contextLoads() { + // Test that the controller loads + assert usersController != null; + // Test that the service loads + assert usersService != null; + } +} + +@WebMvcTest(MerchantsController.class) +class MerchantsControllerTests { + @Resource + private MerchantsController merchantsController; + + @MockBean + private MerchantsService merchantsService; + + @Test + public void contextLoads() { + // Test that the controller loads + assert merchantsController != null; + // Test that the service loads + assert merchantsService != null; + } +} diff --git a/src/test/java/com/example/springdemo/SpringDemoApplicationTests.java b/src/test/java/com/example/springdemo/SpringDemoApplicationTests.java index e64d32a..d5cf3a5 100644 --- a/src/test/java/com/example/springdemo/SpringDemoApplicationTests.java +++ b/src/test/java/com/example/springdemo/SpringDemoApplicationTests.java @@ -1,13 +1,18 @@ package com.example.springdemo; import org.junit.jupiter.api.Test; +import org.springframework.boot.SpringApplication; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest -class SpringDemoApplicationTests { +public class SpringDemoApplicationTests { + @Test + void test(String[] args) { + SpringApplication.run(SpringDemoApplication.class, args); + } - @Test - void contextLoads() { - } + @Test + void contextLoads() { + } }