File tree Expand file tree Collapse file tree 6 files changed +58
-53
lines changed
main/java/com.iluwater.fieild
test/java/com/iluwater/fieild Expand file tree Collapse file tree 6 files changed +58
-53
lines changed Original file line number Diff line number Diff line change 3131
3232 <artifactId >Identity_Field</artifactId >
3333
34+
3435 <properties >
3536 <maven .compiler.source>17</maven .compiler.source>
3637 <maven .compiler.target>17</maven .compiler.target>
3940 <dependencies >
4041 <dependency >
4142 <groupId >org.junit.jupiter</groupId >
42- <artifactId >junit-jupiter-api </artifactId >
43+ <artifactId >junit-jupiter-engine </artifactId >
4344 <scope >test</scope >
4445 </dependency >
45- <dependency >
46- <groupId >com.iluwatar</groupId >
47- <artifactId >update-method</artifactId >
48- <version >1.26.0-SNAPSHOT</version >
49- <scope >compile</scope >
50- </dependency >
5146 <dependency >
5247 <groupId >com.fasterxml.jackson.core</groupId >
5348 <artifactId >jackson-annotations</artifactId >
5449 </dependency >
5550
56- <dependency >
57- <groupId >org.hibernate</groupId >
58- <artifactId >hibernate-core</artifactId >
59- </dependency >
51+
6052 <dependency >
6153 <groupId >jakarta.persistence</groupId >
6254 <artifactId >jakarta.persistence-api</artifactId >
55+ <version >3.1.0</version >
56+ </dependency >
57+ <dependency >
58+ <groupId >javax.persistence</groupId >
59+ <artifactId >javax.persistence-api</artifactId >
6360 </dependency >
6461 </dependencies >
6562
Original file line number Diff line number Diff line change 1+ /*
2+ * The Book class represents a book entity in the application.
3+ *
4+ * <p>This class extends DomainObject and inherits its unique identifier.
5+ * It includes additional fields and methods specific to a book's attributes,
6+ * such as title and author.</p>
7+ */
18package com .iluwater .fieild ;
9+ import lombok .Getter ;
10+ import lombok .Setter ;
211
12+ @ Setter
13+ @ Getter
314public class Book extends DomainObject {
415 private String title ;
516 private String author ;
@@ -10,19 +21,4 @@ public Book(String title, String author) {
1021 this .author = author ;
1122 }
1223
13- public String getTitle () {
14- return title ;
15- }
16-
17- public void setTitle (String title ) {
18- this .title = title ;
19- }
20-
21- public String getAuthor () {
22- return author ;
23- }
24-
25- public void setAuthor (String author ) {
26- this .author = author ;
27- }
2824}
Original file line number Diff line number Diff line change 11package com .iluwater .fieild ;
22
3+ import lombok .Getter ;
4+ import lombok .Setter ;
5+
6+ @ Setter
7+ @ Getter
38public class Client extends DomainObject {
49 private String name ;
510 private String Email ;
611
7-
812 public Client (String name ,String Email ) {
913 this .name = name ;
10- this .Email =Email ;
11- }
12-
13- public void setEmail (String email ) {
14- Email = email ;
15- }
16-
17- public String getName () {
18- return name ;
19- }
20-
21- public void setName (String name ) {
22- this .name = name ;
23- }
24-
25- public String getEmail () {
26- return Email ;
14+ this .Email = Email ;
2715 }
2816
2917}
Original file line number Diff line number Diff line change 1- package com .iluwater .fieild ;
21
3- import javax .persistence .Id ;
2+ /*
3+ * The DomainObject class provides a base for domain entities
4+ * that require unique identification within the application.
5+ *
6+ * <p>All child classes inherit the unique identifier field
7+ * and associated functionality.</p>
8+ */
9+ package com .iluwater .fieild ;
410import javax .persistence .GeneratedValue ;
511import javax .persistence .GenerationType ;
12+ import javax .persistence .Id ;
613import javax .persistence .MappedSuperclass ;
14+ import lombok .Getter ;
15+ import lombok .Setter ;
16+ @ Getter
17+ @ Setter
718@ MappedSuperclass
819public abstract class DomainObject {
9- @ lombok .Setter
10- @ lombok .Getter
11- @ Id
12- @ GeneratedValue (strategy = GenerationType .IDENTITY ) // automatically generate unique values for primary key columns
13- //strategy = GenerationType.IDENTITY generate the primary key value by the database itself using the auto-increment column option
14- private Integer id ;
20+ @ Id
21+ @ GeneratedValue (strategy = GenerationType .IDENTITY ) // automatically generate unique values for primary key columns
22+ //strategy = GenerationType.IDENTITY generate the primary key value by the database itself using the auto-increment column option
23+ private Integer id ;
1524
1625}
Original file line number Diff line number Diff line change @@ -17,5 +17,15 @@ void checkTwoIdsNotEqual()
1717 Book book2 = new Book ("Head first" ,"someone" );
1818 assertNotEquals (book .getId (),book2 .getId ());
1919 }
20+ void checkTitleNotNull ()
21+ {
22+ Book book = new Book ("Design patterns" ,"someone" );
23+ assertNotNull (book .getTitle ());
24+ }
25+ void checkAuthorNotNull ()
26+ {
27+ Book book = new Book ("Design patterns" ,"someone" );
28+ assertNotNull (book .getAuthor ());
29+ }
2030
2131}
Original file line number Diff line number Diff line change 55class ClientTest {
66 void checkIdNotNull ()
77 {
8- Client client = new Client ("John" ,"jhon9201 @gmail.com" );
8+ Client client = new Client ("John" ,"Jhon9201 @gmail.com" );
99 assertNotNull (client .getId ());
1010 }
1111 void checkTwoIdsNotEqual ()
@@ -20,4 +20,9 @@ void checkEmails()
2020 Client client2 =
new Client (
"Sara" ,
"[email protected] " );
2121 assertNotEquals (client .getEmail (),client2 .getEmail ());
2222 }
23+ void checkEmailNotNull ()
24+ {
25+ Client client =
new Client (
"John" ,
"[email protected] " );
26+ assertNotNull (client .getEmail ());
27+ }
2328}
You can’t perform that action at this time.
0 commit comments