Skip to content

Commit 53a9046

Browse files
committed
New improvements
1 parent ac28416 commit 53a9046

File tree

5 files changed

+333
-430
lines changed

5 files changed

+333
-430
lines changed

examples/spring-boot-demo/implementation/pom.xml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,10 +323,35 @@
323323
<rule>
324324
<element>BUNDLE</element>
325325
<limits>
326+
<limit>
327+
<counter>LINE</counter>
328+
<value>COVEREDRATIO</value>
329+
<minimum>${coverage.level}%</minimum>
330+
</limit>
331+
<limit>
332+
<counter>BRANCH</counter>
333+
<value>COVEREDRATIO</value>
334+
<minimum>${coverage.level}%</minimum>
335+
</limit>
336+
<limit>
337+
<counter>METHOD</counter>
338+
<value>COVEREDRATIO</value>
339+
<minimum>${coverage.level}%</minimum>
340+
</limit>
341+
<limit>
342+
<counter>CLASS</counter>
343+
<value>COVEREDRATIO</value>
344+
<minimum>${coverage.level}%</minimum>
345+
</limit>
326346
<limit>
327347
<counter>INSTRUCTION</counter>
328348
<value>COVEREDRATIO</value>
329-
<minimum>0.${coverage.level}</minimum>
349+
<minimum>${coverage.level}%</minimum>
350+
</limit>
351+
<limit>
352+
<counter>COMPLEXITY</counter>
353+
<value>COVEREDRATIO</value>
354+
<minimum>${coverage.level}%</minimum>
330355
</limit>
331356
</limits>
332357
</rule>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package info.jab.ms.controller;
1+
package info.jab.ms;
22

33
import info.jab.ms.common.PostgreSQLTestBase;
44
import java.util.List;
@@ -21,7 +21,7 @@
2121
*
2222
*/
2323
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
24-
class FilmQueryAcceptanceIT extends PostgreSQLTestBase {
24+
class MainApplicaitonAcceptanceIT extends PostgreSQLTestBase {
2525

2626
@LocalServerPort
2727
private int port;

examples/spring-boot-demo/implementation/src/test/java/info/jab/ms/controller/FilmControllerTest.java

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
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)
2926
class 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

Comments
 (0)