Skip to content

Commit

Permalink
PO--1148: Remove some deprecated warnings from the Java build process.
Browse files Browse the repository at this point in the history
  • Loading branch information
RustyHMCTS committed Feb 5, 2025
1 parent 0240fd9 commit d54ab69
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 7 deletions.
6 changes: 5 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ configurations {
}

tasks.withType(JavaCompile).configureEach {
options.compilerArgs << "-Xlint:unchecked" << "-Werror"
options.compilerArgs << "-Xlint:unchecked"
// Enable the following to highlight all deprecated build errors
options.compilerArgs << "-Xlint:deprecation"
// Enable the following to stop the build on any warning messages (not just error messages)
options.compilerArgs << "-Werror"
}

// https://github.com/gradle/gradle/issues/16791
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.hibernate.LazyInitializationException;
import org.hibernate.PropertyValueException;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.postgresql.util.PSQLException;
import org.postgresql.util.PSQLState;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -16,6 +17,7 @@
import org.springframework.dao.DataAccessResourceFailureException;
import org.springframework.dao.InvalidDataAccessApiUsageException;
import org.springframework.dao.InvalidDataAccessResourceUsageException;
import org.springframework.http.HttpInputMessage;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
Expand Down Expand Up @@ -307,7 +309,8 @@ void testHandleHttpMediaTypeNotSupportedException() {

@Test
void testHandleHttpMessageNotReadableException() {
HttpMessageNotReadableException exception = new HttpMessageNotReadableException("Cannot read message");
HttpInputMessage msg = Mockito.mock(HttpInputMessage.class);
HttpMessageNotReadableException exception = new HttpMessageNotReadableException("Cannot read message", msg);
ResponseEntity<Map<String, String>> response = globalExceptionHandler
.handleHttpMessageNotReadableException(exception);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class FileHandlerJobTest {

@BeforeEach
void setUp() {
MockitoAnnotations.initMocks(this);
MockitoAnnotations.openMocks(this);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class LogRetentionJobTest {

@BeforeEach
void setUp() {
MockitoAnnotations.initMocks(this);
MockitoAnnotations.openMocks(this);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class JobServiceTest {

@BeforeEach
void setUp() {
MockitoAnnotations.initMocks(this);
MockitoAnnotations.openMocks(this);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class LogRetentionServiceTest {

@BeforeEach
void setUp() {
MockitoAnnotations.initMocks(this);
MockitoAnnotations.openMocks(this);
logRetentionService = new LogRetentionService(jdbcTemplate);
}

Expand All @@ -39,4 +39,3 @@ void testDeleteExpiredLogAudit_DatabaseError() {
verify(jdbcTemplate).execute("CALL delete_expired_log_audit()");
}
}

0 comments on commit d54ab69

Please sign in to comment.