Skip to content

Commit df1f5c6

Browse files
committed
filling entities ( Author, Book, SchoolBook ) and testing them
1 parent 1490ec1 commit df1f5c6

3 files changed

Lines changed: 162 additions & 0 deletions

File tree

src/main/java/com/epam/izh/rd/online/entity/Author.java

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,71 @@
2020
*/
2121
public class Author {
2222

23+
private String name;
24+
private String lastName;
25+
private LocalDate birthdate;
26+
private String country;
27+
28+
public Author() {
29+
}
30+
31+
public Author(String name, String lastName, LocalDate birthdate, String country) {
32+
this.name = name;
33+
this.lastName = lastName;
34+
this.birthdate = birthdate;
35+
this.country = country;
36+
}
37+
38+
public String getName() {
39+
return name;
40+
}
41+
42+
public void setName(String name) {
43+
this.name = name;
44+
}
45+
46+
public String getLastName() {
47+
return lastName;
48+
}
49+
50+
public void setLastName(String lastName) {
51+
this.lastName = lastName;
52+
}
53+
54+
public LocalDate getBirthdate() {
55+
return birthdate;
56+
}
57+
58+
public void setBirthdate(LocalDate birthdate) {
59+
this.birthdate = birthdate;
60+
}
61+
62+
public String getCountry() {
63+
return country;
64+
}
65+
66+
public void setCountry(String country) {
67+
this.country = country;
68+
}
69+
70+
@Override
71+
public int hashCode() {
72+
return super.hashCode();
73+
}
74+
75+
@Override
76+
public boolean equals(Object obj) {
77+
return super.equals(obj);
78+
}
79+
80+
@Override
81+
public String toString() {
82+
return "Author{" +
83+
"name='" + name + '\'' +
84+
", lastName='" + lastName + '\'' +
85+
", birthdate=" + birthdate +
86+
", country='" + country + '\'' +
87+
'}';
88+
}
89+
2390
}

src/main/java/com/epam/izh/rd/online/entity/Book.java

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,46 @@
1717
*/
1818
public abstract class Book {
1919

20+
private int numberOfPages;
21+
private String name;
22+
23+
public Book() {
24+
}
25+
26+
public Book(int numberOfPages, String name) {
27+
this.numberOfPages = numberOfPages;
28+
this.name = name;
29+
}
30+
31+
public int getNumberOfPages() {
32+
return numberOfPages;
33+
}
34+
35+
public void setNumberOfPages(int numberOfPages) {
36+
this.numberOfPages = numberOfPages;
37+
}
38+
39+
public String getName() {
40+
return name;
41+
}
42+
43+
public void setName(String name) {
44+
this.name = name;
45+
}
46+
47+
@Override
48+
public int hashCode() {
49+
return super.hashCode();
50+
}
51+
52+
@Override
53+
public boolean equals(Object obj) {
54+
return super.equals(obj);
55+
}
56+
57+
@Override
58+
public String toString() {
59+
return super.toString();
60+
}
61+
2062
}

src/main/java/com/epam/izh/rd/online/entity/SchoolBook.java

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,57 @@
2121
*/
2222
public class SchoolBook extends Book {
2323

24+
private String authorName;
25+
private String authorLastName;
26+
private LocalDate publishDate;
27+
28+
public SchoolBook() {
29+
}
30+
31+
public SchoolBook(int numberOfPages, String name, String authorName, String authorLastName, LocalDate publishDate) {
32+
super(numberOfPages, name);
33+
this.authorName = authorName;
34+
this.authorLastName = authorLastName;
35+
this.publishDate = publishDate;
36+
}
37+
38+
public String getAuthorName() {
39+
return authorName;
40+
}
41+
42+
public void setAuthorName(String authorName) {
43+
this.authorName = authorName;
44+
}
45+
46+
public String getAuthorLastName() {
47+
return authorLastName;
48+
}
49+
50+
public void setAuthorLastName(String authorLastName) {
51+
this.authorLastName = authorLastName;
52+
}
53+
54+
public LocalDate getPublishDate() {
55+
return publishDate;
56+
}
57+
58+
public void setPublishDate(LocalDate publishDate) {
59+
this.publishDate = publishDate;
60+
}
61+
62+
@Override
63+
public int hashCode() {
64+
return super.hashCode();
65+
}
66+
67+
@Override
68+
public boolean equals(Object obj) {
69+
return super.equals(obj);
70+
}
71+
72+
@Override
73+
public String toString() {
74+
return super.toString();
75+
}
76+
2477
}

0 commit comments

Comments
 (0)