Skip to content

Commit 759fe7d

Browse files
committed
Restore Java 8 compatibility of tests
1 parent 3947cc2 commit 759fe7d

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

src/jna-test/org/firebirdsql/gds/ng/jna/JnaStatementTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
import org.junit.jupiter.params.ParameterizedTest;
3434
import org.junit.jupiter.params.provider.ValueSource;
3535

36-
import java.nio.charset.StandardCharsets;
3736
import java.sql.SQLException;
37+
import java.util.Arrays;
3838

3939
import static org.firebirdsql.common.FBTestProperties.getDefaultSupportInfo;
4040
import static org.firebirdsql.common.matchers.GdsTypeMatchers.isOtherNativeType;
@@ -341,7 +341,9 @@ private void assertBlobLengthAndContent(FbBlob blob, int size, boolean expectInl
341341
if (size > 0) {
342342
byte[] data = new byte[size];
343343
blob.get(data, 0, size);
344-
assertEquals("x".repeat(size), new String(data, StandardCharsets.US_ASCII));
344+
byte[] expected = new byte[size];
345+
Arrays.fill(expected, (byte) 'x');
346+
assertArrayEquals(expected, data);
345347
}
346348
long receivedBytesAfter = getReceivedBytes();
347349
long receivedBytesDifference = receivedBytesAfter - receivedBytesBefore;

src/test/org/firebirdsql/gds/impl/GDSServerVersionTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import java.io.ByteArrayOutputStream;
3131
import java.io.ObjectInputStream;
3232
import java.io.ObjectOutputStream;
33-
import java.util.List;
33+
import java.util.Arrays;
3434

3535
import static org.junit.jupiter.api.Assertions.*;
3636

@@ -236,9 +236,9 @@ void testIsEqualOrAbove() throws Exception {
236236

237237
@Test
238238
void testGetRawVersions() throws Exception {
239-
var version = GDSServerVersion.parseRawVersion(TEST_VERSION_30);
239+
GDSServerVersion version = GDSServerVersion.parseRawVersion(TEST_VERSION_30);
240240

241-
assertEquals(List.of(TEST_VERSION_30), version.getRawVersions(), "rawVersions");
241+
assertEquals(Arrays.asList(TEST_VERSION_30), version.getRawVersions(), "rawVersions");
242242
}
243243

244244
}

src/test/org/firebirdsql/gds/ng/wire/version19/V19StatementTest.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,14 @@
3131
import org.junit.jupiter.params.ParameterizedTest;
3232
import org.junit.jupiter.params.provider.ValueSource;
3333

34-
import java.nio.charset.StandardCharsets;
3534
import java.sql.SQLException;
35+
import java.util.Arrays;
3636

3737
import static org.firebirdsql.common.extension.RequireProtocolExtension.requireProtocolVersion;
3838
import static org.hamcrest.MatcherAssert.assertThat;
3939
import static org.hamcrest.Matchers.hasSize;
4040
import static org.hamcrest.Matchers.instanceOf;
41+
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
4142
import static org.junit.jupiter.api.Assertions.assertEquals;
4243

4344
/**
@@ -132,7 +133,9 @@ private static void assertBlobLengthAndContent(FbBlob blob, int size) throws SQL
132133
if (size > 0) {
133134
byte[] data = new byte[size];
134135
blob.get(data, 0, size);
135-
assertEquals("x".repeat(size), new String(data, StandardCharsets.US_ASCII));
136+
byte[] expected = new byte[size];
137+
Arrays.fill(expected, (byte) 'x');
138+
assertArrayEquals(expected, data);
136139
}
137140
}
138141

0 commit comments

Comments
 (0)