File tree Expand file tree Collapse file tree
src/test/java/com/mayank/catalog_service Expand file tree Collapse file tree Original file line number Diff line number Diff line change 141141 <version >4.0.24</version >
142142 <scope >test</scope >
143143 </dependency >
144+ <dependency >
145+ <groupId >org.springframework.boot</groupId >
146+ <artifactId >spring-boot-starter-test</artifactId >
147+ <scope >test</scope >
148+ </dependency >
149+ <dependency >
150+ <groupId >org.springframework.boot</groupId >
151+ <artifactId >spring-boot-test-autoconfigure</artifactId >
152+ <scope >test</scope >
153+ </dependency >
154+
155+
144156 </dependencies >
145157
146158 <build >
Original file line number Diff line number Diff line change 77import org .testcontainers .utility .DockerImageName ;
88
99@ TestConfiguration (proxyBeanMethods = false )
10- class TestcontainersConfiguration {
10+ public class TestcontainersConfiguration {
1111
1212 @ Bean
1313 @ ServiceConnection // automatically configures db connection properties
Original file line number Diff line number Diff line change 55import org .springframework .boot .data .jpa .test .autoconfigure .DataJpaTest ;
66import org .springframework .context .annotation .Import ;
77import org .springframework .test .context .jdbc .Sql ;
8- import org . testcontainers . utility .TestcontainersConfiguration ;
9-
8+ import com . mayank . catalog_service .TestcontainersConfiguration ;
9+ //import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
1010import java .math .BigDecimal ;
1111import java .util .List ;
12-
1312import static org .assertj .core .api .Assertions .assertThat ;
13+
1414// slice unit test for testing repository functionality
1515@ DataJpaTest (
1616 properties = {
@@ -25,6 +25,8 @@ class ProductRepositoryTest
2525 @ Autowired
2626 private ProductRepository productRepository ;
2727
28+ // You don't need to test the methods provided by Spring Data JPA.
29+ // This test is to demonstrate how to write tests for the repository layer.
2830 @ Test
2931 void shouldGetAllProducts ()
3032 {
You can’t perform that action at this time.
0 commit comments