Skip to content

Commit

Permalink
ensure UTF-8 in getBytes assert
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-mkubik committed Nov 19, 2024
1 parent 04a476d commit 55e7135
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import static org.junit.Assert.assertTrue;

import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
Expand Down Expand Up @@ -67,8 +67,10 @@ protected void assertGetObjectIsCompatible(ResultSet resultSet, String expected)

protected void assertGetBytesIsCompatible(ResultSet resultSet, String expected)
throws SQLException {
byte[] expectedBytes = expected.getBytes();
TestUtil.assertEqualsIgnoringWhitespace(
expected, new String(resultSet.getBytes(1), Charset.defaultCharset()));
new String(expectedBytes, StandardCharsets.UTF_8),
new String(resultSet.getBytes(1), StandardCharsets.UTF_8));
}

protected void withFirstRow(
Expand Down

0 comments on commit 55e7135

Please sign in to comment.