Skip to content

Commit 7dbafb4

Browse files
authored
API: Don't check underlying error msg on AIOOBE (#12867)
The error msg might be missing when the tests are executed with different JDK versions, so it's better to skip checking the underlying error msg to avoid flakiness in test executions
1 parent 3f661d5 commit 7dbafb4

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

api/src/test/java/org/apache/iceberg/variants/TestSerializedMetadata.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ public class TestSerializedMetadata {
3434
private final Random random = new Random(872591);
3535

3636
@Test
37+
@SuppressWarnings("checkstyle:AssertThatThrownByWithMessageCheck")
3738
public void testEmptyVariantMetadata() {
3839
SerializedMetadata metadata = SerializedMetadata.EMPTY_V1_METADATA;
3940

4041
assertThat(metadata.isSorted()).isFalse();
4142
assertThat(metadata.dictionarySize()).isEqualTo(0);
42-
assertThatThrownBy(() -> metadata.get(0))
43-
.isInstanceOf(ArrayIndexOutOfBoundsException.class)
44-
.hasMessageContaining("out of bounds");
43+
// no check on the underlying error msg as it might be missing based on the JDK version
44+
assertThatThrownBy(() -> metadata.get(0)).isInstanceOf(ArrayIndexOutOfBoundsException.class);
4545
}
4646

4747
@Test
@@ -99,6 +99,7 @@ public void testHeaderOffsetSize() {
9999
}
100100

101101
@Test
102+
@SuppressWarnings("checkstyle:AssertThatThrownByWithMessageCheck")
102103
public void testReadString() {
103104
SerializedMetadata metadata =
104105
SerializedMetadata.from(
@@ -111,12 +112,12 @@ public void testReadString() {
111112
assertThat(metadata.get(2)).isEqualTo("c");
112113
assertThat(metadata.get(3)).isEqualTo("d");
113114
assertThat(metadata.get(4)).isEqualTo("e");
114-
assertThatThrownBy(() -> metadata.get(5))
115-
.isInstanceOf(ArrayIndexOutOfBoundsException.class)
116-
.hasMessageContaining("out of bounds");
115+
// no check on the underlying error msg as it might be missing based on the JDK version
116+
assertThatThrownBy(() -> metadata.get(5)).isInstanceOf(ArrayIndexOutOfBoundsException.class);
117117
}
118118

119119
@Test
120+
@SuppressWarnings("checkstyle:AssertThatThrownByWithMessageCheck")
120121
public void testMultibyteString() {
121122
SerializedMetadata metadata =
122123
SerializedMetadata.from(
@@ -129,12 +130,12 @@ public void testMultibyteString() {
129130
assertThat(metadata.get(2)).isEqualTo("xyz");
130131
assertThat(metadata.get(3)).isEqualTo("d");
131132
assertThat(metadata.get(4)).isEqualTo("e");
132-
assertThatThrownBy(() -> metadata.get(5))
133-
.isInstanceOf(ArrayIndexOutOfBoundsException.class)
134-
.hasMessageContaining("out of bounds");
133+
// no check on the underlying error msg as it might be missing based on the JDK version
134+
assertThatThrownBy(() -> metadata.get(5)).isInstanceOf(ArrayIndexOutOfBoundsException.class);
135135
}
136136

137137
@Test
138+
@SuppressWarnings("checkstyle:AssertThatThrownByWithMessageCheck")
138139
public void testTwoByteOffsets() {
139140
SerializedMetadata metadata =
140141
SerializedMetadata.from(
@@ -148,9 +149,8 @@ public void testTwoByteOffsets() {
148149
assertThat(metadata.get(2)).isEqualTo("xyz");
149150
assertThat(metadata.get(3)).isEqualTo("d");
150151
assertThat(metadata.get(4)).isEqualTo("e");
151-
assertThatThrownBy(() -> metadata.get(5))
152-
.isInstanceOf(ArrayIndexOutOfBoundsException.class)
153-
.hasMessageContaining("out of bounds");
152+
// no check on the underlying error msg as it might be missing based on the JDK version
153+
assertThatThrownBy(() -> metadata.get(5)).isInstanceOf(ArrayIndexOutOfBoundsException.class);
154154
}
155155

156156
@Test

0 commit comments

Comments
 (0)