File tree Expand file tree Collapse file tree 2 files changed +6
-10
lines changed
main/java/com/codesungrape/hmcts/BookAPI/service
test/java/com/codesungrape/hmcts/BookAPI Expand file tree Collapse file tree 2 files changed +6
-10
lines changed Original file line number Diff line number Diff line change 66import lombok .RequiredArgsConstructor ;
77
88import com .codesungrape .hmcts .BookAPI .entity .Book ;
9- import java .util .List ;
10- import java .util .Optional ;
11- import java .util .UUID ;
129
1310/**
1411 * Service layer responsible for all business logic related to the Book resource.
@@ -22,7 +19,7 @@ public class BookService {
2219
2320 // 1. CREATE Operation (POST /books)
2421 public Book createBook (BookRequest request ) {
25- // Validation check for business rules (e.g., uniqueness, if required) would go here
22+ // Validation check for business rules (e.g., uniqueness, if required)
2623 if (request == null ) {
2724 throw new NullPointerException ("BookRequest cannot be null" );
2825 }
Original file line number Diff line number Diff line change 1010import org .junit .jupiter .params .provider .Arguments ;
1111import org .mockito .InjectMocks ;
1212import org .mockito .Mock ;
13- import org .mockito .MockitoAnnotations ;
1413import org .mockito .junit .jupiter .MockitoExtension ;
15- import org .springframework .util .Assert ;
1614import org .junit .jupiter .params .ParameterizedTest ;
17- import org .junit .jupiter .params .provider .CsvSource ;
1815import org .junit .jupiter .params .provider .MethodSource ;
19- import org .junit .jupiter .params .provider .Arguments ;
2016import java .util .stream .Stream ;
2117
22- import java .util .Optional ;
2318import java .util .UUID ;
2419
2520import static org .mockito .ArgumentMatchers .any ;
@@ -171,7 +166,11 @@ void testCreateBook_RepositoryReturnsNull_HandlesGracefully() {
171166
172167 @ ParameterizedTest (name = "{0}" ) // Display the test name
173168 @ MethodSource ("provideLongFieldTestCases" )
174- void testCreateBook_VeryLongFields_Success (String testName , BookRequest request , Book expectedBook ) {
169+ void testCreateBook_VeryLongFields_Success (
170+ String testName ,
171+ BookRequest request ,
172+ Book expectedBook
173+ ) {
175174
176175 // Arrange
177176 when (testBookRepository .save (any (Book .class )))
You can’t perform that action at this time.
0 commit comments