Skip to content

Suppress resource warnings in existing tests #1459

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions driver/src/test/java/org/neo4j/driver/ParametersTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ void shouldGiveHelpfulMessageOnMisalignedInput(Object obj, String expectedMsg) {

@ParameterizedTest
@MethodSource("addressesToParse")
@SuppressWarnings("resource")
void shouldNotBePossibleToUseInvalidParameterTypesViaParameters(Object obj, String expectedMsg) {
var session = mockedSession();
var e = assertThrows(ClientException.class, () -> session.run("RETURN {a}", parameters("a", obj)));
Expand All @@ -81,6 +82,7 @@ void shouldNotBePossibleToUseInvalidParameterTypesViaParameters(Object obj, Stri

@ParameterizedTest
@MethodSource("addressesToParse")
@SuppressWarnings("resource")
void shouldNotBePossibleToUseInvalidParametersViaMap(Object obj, String expectedMsg) {
var session = mockedSession();
var e = assertThrows(ClientException.class, () -> session.run("RETURN {a}", singletonMap("a", obj)));
Expand All @@ -89,6 +91,7 @@ void shouldNotBePossibleToUseInvalidParametersViaMap(Object obj, String expected

@ParameterizedTest
@MethodSource("addressesToParse")
@SuppressWarnings("resource")
void shouldNotBePossibleToUseInvalidParametersViaRecord(Object obj, String expectedMsg) {
assumeTrue(obj instanceof Value);
Record record = new InternalRecord(singletonList("a"), new Value[] {(Value) obj});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ void shouldFailWhenTLSHandshakeTakesTooLong() throws Exception {
}

@Test
@SuppressWarnings("resource")
void shouldThrowServiceUnavailableExceptionOnFailureDuringConnect() throws Exception {
var server = new ServerSocket(0);
var address = new BoltServerAddress("localhost", server.getLocalPort());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ void tearDown() {
}

@Test
@SuppressWarnings("resource")
void shouldErrorToAccessRecordsAfterConsume() {
// Given
var result = neo4j.driver().session().run("UNWIND [1,2] AS a RETURN a");
Expand All @@ -70,6 +71,7 @@ void shouldErrorToAccessRecordsAfterConsume() {
}

@Test
@SuppressWarnings("resource")
void shouldErrorToAccessRecordsAfterClose() {
// Given
var session = neo4j.driver().session();
Expand All @@ -90,6 +92,7 @@ void shouldErrorToAccessRecordsAfterClose() {
}

@Test
@SuppressWarnings("resource")
void shouldAllowConsumeAndKeysAfterConsume() {
// Given
var result = neo4j.driver().session().run("UNWIND [1,2] AS a RETURN a");
Expand All @@ -107,6 +110,7 @@ void shouldAllowConsumeAndKeysAfterConsume() {
}

@Test
@SuppressWarnings("resource")
void shouldAllowSummaryAndKeysAfterClose() {
// Given
var session = neo4j.driver().session();
Expand All @@ -126,6 +130,7 @@ void shouldAllowSummaryAndKeysAfterClose() {
}

@Test
@SuppressWarnings("resource")
void shouldErrorToAccessRecordsAfterConsumeAsync() {
// Given
var session = neo4j.driver().session(AsyncSession.class);
Expand All @@ -144,6 +149,7 @@ void shouldErrorToAccessRecordsAfterConsumeAsync() {
}

@Test
@SuppressWarnings("resource")
void shouldErrorToAccessRecordsAfterCloseAsync() {
// Given
var session = neo4j.driver().session(AsyncSession.class);
Expand All @@ -162,6 +168,7 @@ void shouldErrorToAccessRecordsAfterCloseAsync() {
}

@Test
@SuppressWarnings("resource")
void shouldAllowConsumeAndKeysAfterConsumeAsync() {
// Given
var session = neo4j.driver().session(AsyncSession.class);
Expand All @@ -181,6 +188,7 @@ void shouldAllowConsumeAndKeysAfterConsumeAsync() {
}

@Test
@SuppressWarnings("resource")
void shouldAllowConsumeAndKeysAfterCloseAsync() {
// Given
var session = neo4j.driver().session(AsyncSession.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ void beforeAll() {
}

@Test
@SuppressWarnings("resource")
void shouldSetTransactionMetadata() {
Map<String, Object> metadata = new HashMap<>();
metadata.put("a", "hello world");
Expand Down Expand Up @@ -104,6 +105,7 @@ void shouldSetTransactionMetadataAsync() {
}

@Test
@SuppressWarnings("resource")
void shouldSetTransactionTimeout() {
// create a dummy node
var session = driver.session();
Expand All @@ -128,6 +130,7 @@ void shouldSetTransactionTimeout() {
}

@Test
@SuppressWarnings("resource")
void shouldSetTransactionTimeoutAsync() {
// create a dummy node
var asyncSession = driver.asyncSession();
Expand Down
Loading