2121 * This test class implements unit testing for the FilmController REST API endpoints
2222 * following TDD approach. Tests focus on controller behavior, parameter handling,
2323 * and response formatting without database dependencies.
24- *
25- * Task 3.1: Create unit test for GET /api/v1/films endpoint without parameters ✅
26- * Task 3.2: Create unit test for GET /api/v1/films?startsWith=A endpoint ✅
2724 */
2825@ WebMvcTest (FilmController .class )
2926class FilmControllerTest {
@@ -35,8 +32,6 @@ class FilmControllerTest {
3532 private FilmService filmService ;
3633
3734 /**
38- * Task 3.1: Create unit test for GET /api/v1/films endpoint without parameters
39- *
4035 * This test verifies the behavior when calling GET /api/v1/films without
4136 * the startsWith parameter. The controller should handle this case and
4237 * potentially return all films or an appropriate default response.
@@ -81,8 +76,6 @@ void shouldGetFilmsWithoutParameters() throws Exception {
8176 }
8277
8378 /**
84- * Task 3.2: Create unit test for GET /api/v1/films?startsWith=A endpoint
85- *
8679 * This test verifies the behavior when calling GET /api/v1/films with
8780 * the startsWith=A parameter. The controller should handle this case and
8881 * return films starting with the letter "A".
@@ -143,8 +136,6 @@ void shouldGetFilmsStartingWithA() throws Exception {
143136 }
144137
145138 /**
146- * Task 3.3: Create unit tests for parameter validation (valid single letters)
147- *
148139 * These tests verify that the controller properly accepts valid single letter parameters.
149140 * Valid parameters include:
150141 * - Uppercase letters A-Z
@@ -284,13 +275,7 @@ void shouldAcceptValidParameterAndCallServiceCorrectly() throws Exception {
284275 .andExpect (jsonPath ("$.films[1].title" ).value ("BRAVE HEART" ));
285276 }
286277
287- // ========================================================================
288- // Task 3.4: Create unit tests for invalid parameter scenarios
289- // ========================================================================
290-
291278 /**
292- * Task 3.4: Create unit tests for invalid parameter scenarios (empty, multiple chars, special chars)
293- *
294279 * These tests verify that the controller properly rejects invalid parameters and returns
295280 * appropriate HTTP 400 Bad Request responses with error messages.
296281 *
@@ -363,13 +348,7 @@ void shouldRejectWhitespaceParameter() throws Exception {
363348 .andExpect (status ().isBadRequest ());
364349 }
365350
366- // ========================================================================
367- // Task 3.5: Create unit tests for response format validation (JSON structure)
368- // ========================================================================
369-
370351 /**
371- * Task 3.5: Create unit tests for response format validation (JSON structure)
372- *
373352 * These tests verify that the controller returns responses in the expected JSON format
374353 * with the correct structure, field names, and data types.
375354 *
@@ -497,13 +476,7 @@ void shouldReturnCorrectJSONStructureForNoParameterResponse() throws Exception {
497476 .andExpect (jsonPath ("$.filter" ).isEmpty ());
498477 }
499478
500- // ========================================================================
501- // Task 3.6: Create unit tests for HTTP status codes (200, 400)
502- // ========================================================================
503-
504479 /**
505- * Task 3.6: Create unit tests for HTTP status codes (200, 400)
506- *
507480 * These tests verify that the controller returns appropriate HTTP status codes
508481 * for different scenarios:
509482 * - 200 OK for successful requests
@@ -570,13 +543,7 @@ void shouldReturn400ForEmptyParameter() throws Exception {
570543 .andExpect (status ().is (400 ));
571544 }
572545
573- // ========================================================================
574- // Task 3.7: Create unit tests for controller error handling integration
575- // ========================================================================
576-
577546 /**
578- * Task 3.7: Create unit tests for controller error handling integration
579- *
580547 * These tests verify that the controller properly integrates with global error handling
581548 * and returns consistent error responses following RFC 7807 Problem Details format.
582549 *
@@ -641,13 +608,7 @@ void shouldProvideConsistentErrorResponseFormat() throws Exception {
641608 }
642609 }
643610
644- // ========================================================================
645- // Task 3.8: Create unit tests for OpenAPI annotations validation
646- // ========================================================================
647-
648611 /**
649- * Task 3.8: Create unit tests for OpenAPI annotations validation
650- *
651612 * These tests verify that the controller has proper OpenAPI annotations for documentation.
652613 * While unit tests can't directly test annotation presence, they can verify that the
653614 * controller behaves according to the documented API contract.
0 commit comments