From 935edb671eb10b977879d485c9a9497dbca872d5 Mon Sep 17 00:00:00 2001 From: Sven Hettwer Date: Fri, 15 Feb 2019 15:33:49 +0100 Subject: [PATCH] Fixed circular hashCode/equals calls --- .../com/consol/citrus/db/driver/JdbcPreparedStatement.java | 3 +-- .../main/java/com/consol/citrus/db/driver/JdbcStatement.java | 5 ++--- .../consol/citrus/db/driver/JdbcCallableStatementTest.java | 1 + .../consol/citrus/db/driver/JdbcPreparedStatementTest.java | 1 + .../java/com/consol/citrus/db/driver/JdbcStatementTest.java | 1 + 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/driver/src/main/java/com/consol/citrus/db/driver/JdbcPreparedStatement.java b/driver/src/main/java/com/consol/citrus/db/driver/JdbcPreparedStatement.java index 1aa2bf5..4128ae9 100644 --- a/driver/src/main/java/com/consol/citrus/db/driver/JdbcPreparedStatement.java +++ b/driver/src/main/java/com/consol/citrus/db/driver/JdbcPreparedStatement.java @@ -356,8 +356,7 @@ public final boolean equals(final Object o) { Objects.equals(parameters, that.parameters)&& Objects.equals(httpClient, that.httpClient) && Objects.equals(serverUrl, that.serverUrl) && - Objects.equals(connection, that.connection) && - Objects.equals(resultSet, that.resultSet); + Objects.equals(connection, that.connection); } @Override diff --git a/driver/src/main/java/com/consol/citrus/db/driver/JdbcStatement.java b/driver/src/main/java/com/consol/citrus/db/driver/JdbcStatement.java index 5a46244..cea0010 100644 --- a/driver/src/main/java/com/consol/citrus/db/driver/JdbcStatement.java +++ b/driver/src/main/java/com/consol/citrus/db/driver/JdbcStatement.java @@ -385,13 +385,12 @@ public boolean equals(final Object o) { final JdbcStatement that = (JdbcStatement) o; return Objects.equals(httpClient, that.httpClient) && Objects.equals(serverUrl, that.serverUrl) && - Objects.equals(connection, that.connection) && - Objects.equals(resultSet, that.resultSet); + Objects.equals(connection, that.connection); } @Override public int hashCode() { - return Objects.hash(httpClient, serverUrl, connection, resultSet); + return Objects.hash(httpClient, serverUrl, connection); } @Override diff --git a/driver/src/test/java/com/consol/citrus/db/driver/JdbcCallableStatementTest.java b/driver/src/test/java/com/consol/citrus/db/driver/JdbcCallableStatementTest.java index aba9b42..87255b6 100644 --- a/driver/src/test/java/com/consol/citrus/db/driver/JdbcCallableStatementTest.java +++ b/driver/src/test/java/com/consol/citrus/db/driver/JdbcCallableStatementTest.java @@ -751,6 +751,7 @@ public void equalsContract(){ new JdbcResultSet(mock(DataSet.class), mock(JdbcStatement.class)), new JdbcResultSet(mock(DataSet.class), mock(JdbcStatement.class))) .suppress(Warning.NONFINAL_FIELDS) + .withIgnoredFields("resultSet") .verify(); } diff --git a/driver/src/test/java/com/consol/citrus/db/driver/JdbcPreparedStatementTest.java b/driver/src/test/java/com/consol/citrus/db/driver/JdbcPreparedStatementTest.java index 1f12c28..9372607 100644 --- a/driver/src/test/java/com/consol/citrus/db/driver/JdbcPreparedStatementTest.java +++ b/driver/src/test/java/com/consol/citrus/db/driver/JdbcPreparedStatementTest.java @@ -85,6 +85,7 @@ public void equalsContract(){ new JdbcResultSet(PowerMockito.mock(DataSet.class), PowerMockito.mock(JdbcStatement.class))) .withRedefinedSuperclass() .suppress(Warning.NONFINAL_FIELDS) + .withIgnoredFields("resultSet") .verify(); } } \ No newline at end of file diff --git a/driver/src/test/java/com/consol/citrus/db/driver/JdbcStatementTest.java b/driver/src/test/java/com/consol/citrus/db/driver/JdbcStatementTest.java index aa4db39..8e84642 100644 --- a/driver/src/test/java/com/consol/citrus/db/driver/JdbcStatementTest.java +++ b/driver/src/test/java/com/consol/citrus/db/driver/JdbcStatementTest.java @@ -266,6 +266,7 @@ public void equalsContract(){ new JdbcResultSet(PowerMockito.mock(DataSet.class), PowerMockito.mock(JdbcStatement.class))) .withRedefinedSubclass(JdbcPreparedStatement.class) .suppress(Warning.NONFINAL_FIELDS) + .withIgnoredFields("resultSet") .verify(); } } \ No newline at end of file