Skip to content
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

Fix TestKit encoding where ByteBuffer.array may not exactly represent UTF8 encoded bytes #264

Closed
wants to merge 1 commit into from
Closed
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
6 changes: 3 additions & 3 deletions r2dbc-spi-test/src/main/java/io/r2dbc/spi/test/TestKit.java
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ default void blobSelect() {

@Override
protected void setValues(PreparedStatement ps, LobCreator lobCreator) throws SQLException {
lobCreator.setBlobAsBytes(ps, 1, StandardCharsets.UTF_8.encode("test-value").array());
lobCreator.setBlobAsBytes(ps, 1, "test-value".getBytes(StandardCharsets.UTF_8));
}

});
Expand All @@ -443,7 +443,7 @@ protected void setValues(PreparedStatement ps, LobCreator lobCreator) throws SQL
Connection::close)
.as(StepVerifier::create)
.expectNextMatches(actual -> {
ByteBuffer expected = StandardCharsets.UTF_8.encode("test-value");
ByteBuffer expected = ByteBuffer.wrap("test-value".getBytes(StandardCharsets.UTF_8));
return Arrays.equals(expected.array(), actual);
})
.verifyComplete();
Expand All @@ -462,7 +462,7 @@ protected void setValues(PreparedStatement ps, LobCreator lobCreator) throws SQL
.as(StepVerifier::create)
.expectNextMatches(actual -> {
ByteBuffer expected = StandardCharsets.UTF_8.encode("test-value");
return Arrays.equals(expected.array(), actual.array());
return actual.compareTo(expected) == 0;
})
.verifyComplete();
}
Expand Down