File tree Expand file tree Collapse file tree 7 files changed +14
-43
lines changed
test/java/com/iluwater/fieild Expand file tree Collapse file tree 7 files changed +14
-43
lines changed Original file line number Diff line number Diff line change 3030 </parent >
3131 <artifactId >Identity_Field</artifactId >
3232
33- <repositories >
34- <repository >
35- <id >jitpack.io</id >
36- <url >https://jitpack.io</url >
37- </repository >
38- </repositories >
39-
4033 <properties >
4134 <maven .compiler.source>17</maven .compiler.source>
4235 <maven .compiler.target>17</maven .compiler.target>
5649 <dependency >
5750 <groupId >com.h2database</groupId >
5851 <artifactId >h2</artifactId >
59- <scope >runtime </scope >
52+ <scope >test </scope >
6053 </dependency >
6154 <dependency >
6255 <groupId >org.springframework.boot</groupId >
7669 <artifactId >spring-context</artifactId >
7770 <scope >test</scope >
7871 </dependency >
79- <dependency >
80- <groupId >org.springframework.data</groupId >
81- <artifactId >spring-data-jpa</artifactId >
82- <scope >test</scope >
83- </dependency >
84- <dependency >
85- <groupId >org.springframework.data</groupId >
86- <artifactId >spring-data-jpa</artifactId >
87- <scope >test</scope >
88- </dependency >
89- <dependency >
90- <groupId >org.springframework</groupId >
91- <artifactId >spring-context</artifactId >
92- </dependency >
9372 <dependency >
9473 <groupId >org.springframework</groupId >
9574 <artifactId >spring-web</artifactId >
9978 <artifactId >mockito-core</artifactId >
10079 <scope >test</scope >
10180 </dependency >
102- <dependency >
103- <groupId >org.mockito</groupId >
104- <artifactId >mockito-core</artifactId >
105- <scope >test</scope >
106- </dependency >
10781 </dependencies >
10882
10983</project >
Original file line number Diff line number Diff line change 11package com .iluwater .fieild .Controller ;
2- import com .iluwater .fieild .Model .*;
32
43import com .iluwater .fieild .Model .Book ;
54import com .iluwater .fieild .Services .BookService ;
Original file line number Diff line number Diff line change 11package com .iluwater .fieild .Services ;
22import com .iluwater .fieild .Model .Book ;
3+ import org .springframework .beans .factory .annotation .Autowired ;
34import org .springframework .stereotype .Repository ;
45import javax .persistence .EntityManager ;
5- import java .util .ArrayList ;
6- import java .util .List ;
7- import java .util .Objects ;
86
97@ Repository
108public class BookRepository {
9+ @ Autowired
1110 private EntityManager entityManager ;
1211
1312 public Book createBook (String title ,String author ) {
Original file line number Diff line number Diff line change 22import com .iluwater .fieild .Model .*;
33import org .springframework .beans .factory .annotation .Autowired ;
44import org .springframework .stereotype .Service ;
5- import java .util .Objects ;
65
76@ Service
87public class BookService {
Original file line number Diff line number Diff line change 1+ spring.datasource.url =jdbc:h2:mem:testdb
2+ spring.datasource.driver-class-name =org.h2.Driver
3+ spring.datasource.username =sa
4+ spring.datasource.password =password
5+ spring.jpa.database-platform =org.hibernate.dialect.H2Dialect
6+ spring.jpa.hibernate.ddl-auto =create-drop
Original file line number Diff line number Diff line change 2727
2828import com .iluwater .fieild .Controller .BookController ;
2929import com .iluwater .fieild .Model .Book ;
30- import com .iluwater .fieild .Services .BookRepository ;
3130import com .iluwater .fieild .Services .BookService ;
3231import org .junit .jupiter .api .Test ;
3332import org .mockito .Mock ;
Original file line number Diff line number Diff line change 11package com .iluwater .fieild ;
22
3- import com .iluwater .fieild .Services .BookRepository ;
4- import com .iluwater .fieild .Services .BookService ;
5- import org .mockito .Mock ;
6-
73public class BookTestApp {
8- private BookRepository bookRepository ;
94 public static void main (String ... args ) {
10-
115 BookTest bt =new BookTest ();
12- bt .checkAuthorNotNull ();
13- bt .checkIdNotNull ();
14- bt .checkTitleNotNull ();
15- bt .checkTwoIdsNotEqual ();
6+ bt .checkAuthorNotNull ();
7+ bt .checkIdNotNull ();
8+ bt .checkTitleNotNull ();
9+ bt .checkTwoIdsNotEqual ();
10+ bt .checkSearch ();
1611
1712 }
1813 }
You can’t perform that action at this time.
0 commit comments