Question: Book and Chapter classes are given below. They already have some fields defined, and your task is to use javax validation annotations to define constraints
Book and Chapter classes are given below. They already have some fields defined, and your task is to use javax validation annotations to define constraints on them.
Requirements
An instance of the Book class should pass javax validation only if:
the title is not empty;
Book has at least one chapter,
every chapter has a title that is not null, and each chapter's number of pages is greater than
;
Book has at least one, and at most three, authors; if the list of authors contains a null string, it should be considered invalid;
its ISBN number is a digit number;
both lastEditionPublishDate and firstEditionPubshDate are not null;
lastEditionPubshDate is not earlier than firstEditionPublishDate;
the sum of pages in all chapters is equal to the book's numberofPages
Bear in mind that the test cases that are used to score the solution run the javax validator only on Book instances. You should ensure that the validation of Book also involves the validation of all its
Chapter S
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
