This is an automated email from the ASF dual-hosted git repository.
etudenhoefner pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iceberg.git
The following commit(s) were added to refs/heads/master by this push:
new c1e877a567 Core: Switch tests to JUnit5 in avro, data.avro packages
(#8380)
c1e877a567 is described below
commit c1e877a567b5b5f4b4895b7ec9b1cf9b449d4bfe
Author: Song Minseok <[email protected]>
AuthorDate: Wed Sep 20 15:41:03 2023 +0900
Core: Switch tests to JUnit5 in avro, data.avro packages (#8380)
---
.../apache/iceberg/avro/TestAvroNameMapping.java | 78 +++---
.../iceberg/avro/TestAvroReadProjection.java | 21 +-
.../iceberg/avro/TestBuildAvroProjection.java | 94 +++----
.../apache/iceberg/avro/TestReadProjection.java | 270 ++++++++++++---------
.../iceberg/data/avro/TestDecoderResolver.java | 30 +--
5 files changed, 278 insertions(+), 215 deletions(-)
diff --git
a/core/src/test/java/org/apache/iceberg/avro/TestAvroNameMapping.java
b/core/src/test/java/org/apache/iceberg/avro/TestAvroNameMapping.java
index 2efb5c8f9a..f4c7ee883e 100644
--- a/core/src/test/java/org/apache/iceberg/avro/TestAvroNameMapping.java
+++ b/core/src/test/java/org/apache/iceberg/avro/TestAvroNameMapping.java
@@ -41,8 +41,7 @@ import
org.apache.iceberg.relocated.com.google.common.collect.Lists;
import org.apache.iceberg.types.Comparators;
import org.apache.iceberg.types.Types;
import org.assertj.core.api.Assertions;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
@SuppressWarnings("unchecked")
public class TestAvroNameMapping extends TestAvroReadProjection {
@@ -81,11 +80,13 @@ public class TestAvroNameMapping extends
TestAvroReadProjection {
Record projected = writeAndRead(writeSchema, readSchema, record,
nameMapping);
// field id 5 comes from read schema
- Assert.assertNotNull(
- "Field missing from table mapping is renamed",
- projected.getSchema().getField("location_r5"));
- Assert.assertNull("location field should not be read",
projected.get("location_r5"));
- Assert.assertEquals(34L, projected.get("id"));
+ Assertions.assertThat(projected.getSchema().getField("location_r5"))
+ .as("Field missing from table mapping is renamed")
+ .isNotNull();
+ Assertions.assertThat(projected.get("location_r5"))
+ .as("location field should not be read")
+ .isNull();
+ Assertions.assertThat(projected.get("id")).isEqualTo(34L);
// Table mapping partially project `location` map value
nameMapping =
@@ -104,9 +105,12 @@ public class TestAvroNameMapping extends
TestAvroReadProjection {
projected = writeAndRead(writeSchema, readSchema, record, nameMapping);
Record projectedL1 = ((Map<String, Record>)
projected.get("location")).get("l1");
- Assert.assertNotNull(
- "Field missing from table mapping is renamed",
projectedL1.getSchema().getField("long_r2"));
- Assert.assertNull("location.value.long, should not be read",
projectedL1.get("long_r2"));
+ Assertions.assertThat(projectedL1.getSchema().getField("long_r2"))
+ .as("Field missing from table mapping is renamed")
+ .isNotNull();
+ Assertions.assertThat(projectedL1.get("long_r2"))
+ .as("location.value.long, should not be read")
+ .isNull();
}
@Test
@@ -176,13 +180,15 @@ public class TestAvroNameMapping extends
TestAvroReadProjection {
Map<Record, Record> projectedLocation = (Map<Record, Record>)
projected.get("location");
Record projectedKey = projectedLocation.keySet().iterator().next();
Record projectedValue = projectedLocation.values().iterator().next();
- Assert.assertEquals(
- 0, Comparators.charSequences().compare("k1", (CharSequence)
projectedKey.get("k1")));
- Assert.assertEquals(
- 0, Comparators.charSequences().compare("k2", (CharSequence)
projectedKey.get("k2")));
- Assert.assertEquals(52.995143f, projectedValue.get("lat"));
- Assert.assertNotNull(projectedValue.getSchema().getField("long_r2"));
- Assert.assertNull(projectedValue.get("long_r2"));
+ Assertions.assertThat(
+ Comparators.charSequences().compare("k1", (CharSequence)
projectedKey.get("k1")))
+ .isEqualTo(0);
+ Assertions.assertThat(
+ Comparators.charSequences().compare("k2", (CharSequence)
projectedKey.get("k2")))
+ .isEqualTo(0);
+ Assertions.assertThat(projectedValue.get("lat")).isEqualTo(52.995143f);
+
Assertions.assertThat(projectedValue.getSchema().getField("long_r2")).isNotNull();
+ Assertions.assertThat(projectedValue.get("long_r2")).isNull();
}
@Test
@@ -243,11 +249,11 @@ public class TestAvroNameMapping extends
TestAvroReadProjection {
Schema readSchema = writeSchema;
Record projected = writeAndRead(writeSchema, readSchema, record,
nameMapping);
- Assert.assertNotNull(
- "Field missing from table mapping is renamed",
projected.getSchema().getField("point_r22"));
- Assert.assertNull("point field is not projected",
projected.get("point_r22"));
- Assert.assertEquals(34L, projected.get("id"));
-
+ Assertions.assertThat(projected.getSchema().getField("point_r22"))
+ .as("Field missing from table mapping is renamed")
+ .isNotNull();
+ Assertions.assertThat(projected.get("point_r22")).as("point field is not
projected").isNull();
+ Assertions.assertThat(projected.get("id")).isEqualTo(34L);
// point array is partially projected
nameMapping =
MappingUtil.create(
@@ -263,12 +269,12 @@ public class TestAvroNameMapping extends
TestAvroReadProjection {
projected = writeAndRead(writeSchema, readSchema, record, nameMapping);
Record point = ((List<Record>) projected.get("point")).get(0);
-
- Assert.assertNotNull(
- "Field missing from table mapping is renamed",
point.getSchema().getField("y_r18"));
- Assert.assertEquals("point.x is projected", 1, point.get("x"));
- Assert.assertNull("point.y is not projected", point.get("y_r18"));
- Assert.assertEquals(34L, projected.get("id"));
+ Assertions.assertThat(point.getSchema().getField("y_r18"))
+ .as("Field missing from table mapping is renamed")
+ .isNotNull();
+ Assertions.assertThat(point.get("x")).as("point.x is
projected").isEqualTo(1);
+ Assertions.assertThat(point.get("y_r18")).as("point.y is not
projected").isNull();
+ Assertions.assertThat(projected.get("id")).isEqualTo(34L);
}
@Test
@@ -316,8 +322,9 @@ public class TestAvroNameMapping extends
TestAvroReadProjection {
Types.NestedField.required(19, "y",
Types.IntegerType.get())))));
Record projected = writeAndRead(writeSchema, readSchema, record,
nameMapping);
- Assert.assertEquals(
- "x is read as y", 1, ((List<Record>)
projected.get("points")).get(0).get("y"));
+ Assertions.assertThat(((List<Record>)
projected.get("points")).get(0).get("y"))
+ .as("x is read as y")
+ .isEqualTo(1);
readSchema =
new Schema(
@@ -331,8 +338,9 @@ public class TestAvroNameMapping extends
TestAvroReadProjection {
Types.NestedField.required(19, "z",
Types.IntegerType.get())))));
projected = writeAndRead(writeSchema, readSchema, record, nameMapping);
- Assert.assertEquals(
- "x is read as z", 1, ((List<Record>)
projected.get("points")).get(0).get("z"));
+ Assertions.assertThat(((List<Record>)
projected.get("points")).get(0).get("z"))
+ .as("x is read as z")
+ .isEqualTo(1);
}
@Test
@@ -349,7 +357,7 @@ public class TestAvroNameMapping extends
TestAvroReadProjection {
Schema readSchema = writeSchema;
// Pass null for nameMapping so that it is automatically inferred from
read schema
Record projected = writeAndRead(writeSchema, readSchema, record, null);
- Assert.assertEquals(record, projected);
+ Assertions.assertThat(projected).isEqualTo(record);
}
@Test
@@ -369,7 +377,7 @@ public class TestAvroNameMapping extends
TestAvroReadProjection {
Record record = super.writeAndRead(desc, writeSchema, readSchema,
inputRecord);
Record projectedWithNameMapping =
writeAndRead(writeSchema, readSchema, inputRecord,
MappingUtil.create(writeSchema));
- Assert.assertEquals(record, projectedWithNameMapping);
+ Assertions.assertThat(projectedWithNameMapping).isEqualTo(record);
return record;
}
@@ -377,7 +385,7 @@ public class TestAvroNameMapping extends
TestAvroReadProjection {
Schema writeSchema, Schema readSchema, Record record, NameMapping
nameMapping)
throws IOException {
- File file = temp.newFile();
+ File file = temp.resolve("test.avro").toFile();
// Write without file ids
org.apache.avro.Schema writeAvroSchema = RemoveIds.removeIds(writeSchema);
DatumWriter<Record> datumWriter = new
GenericDatumWriter<>(writeAvroSchema);
diff --git
a/core/src/test/java/org/apache/iceberg/avro/TestAvroReadProjection.java
b/core/src/test/java/org/apache/iceberg/avro/TestAvroReadProjection.java
index 0049357def..e3aca9baef 100644
--- a/core/src/test/java/org/apache/iceberg/avro/TestAvroReadProjection.java
+++ b/core/src/test/java/org/apache/iceberg/avro/TestAvroReadProjection.java
@@ -30,16 +30,15 @@ import
org.apache.iceberg.relocated.com.google.common.collect.ImmutableList;
import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap;
import org.apache.iceberg.relocated.com.google.common.collect.Iterables;
import org.apache.iceberg.types.Types;
-import org.junit.Assert;
-import org.junit.Test;
+import org.assertj.core.api.Assertions;
+import org.junit.jupiter.api.Test;
public class TestAvroReadProjection extends TestReadProjection {
@Override
protected GenericData.Record writeAndRead(
String desc, Schema writeSchema, Schema readSchema, GenericData.Record
record)
throws IOException {
- File file = temp.newFile(desc + ".avro");
- file.delete();
+ File file = temp.resolve(desc + ".avro").toFile();
try (FileAppender<GenericData.Record> appender =
Avro.write(Files.localOutput(file)).schema(writeSchema).build()) {
@@ -73,13 +72,11 @@ public class TestAvroReadProjection extends
TestReadProjection {
GenericData.Record projected =
writeAndRead("full_projection", writeSchema, writeSchema, record);
- Assert.assertEquals(
- "Should contain correct value list",
- values1,
- ((Map<Long, List<Long>>) projected.get("map")).get(100L));
- Assert.assertEquals(
- "Should contain correct value list",
- values2,
- ((Map<Long, List<Long>>) projected.get("map")).get(200L));
+ Assertions.assertThat(((Map<Long, List<Long>>)
projected.get("map")).get(100L))
+ .as("Should contain correct value list")
+ .isEqualTo(values1);
+ Assertions.assertThat(((Map<Long, List<Long>>)
projected.get("map")).get(200L))
+ .as("Should contain correct value list")
+ .isEqualTo(values2);
}
}
diff --git
a/core/src/test/java/org/apache/iceberg/avro/TestBuildAvroProjection.java
b/core/src/test/java/org/apache/iceberg/avro/TestBuildAvroProjection.java
index edee46685e..40c04de050 100644
--- a/core/src/test/java/org/apache/iceberg/avro/TestBuildAvroProjection.java
+++ b/core/src/test/java/org/apache/iceberg/avro/TestBuildAvroProjection.java
@@ -19,14 +19,14 @@
package org.apache.iceberg.avro;
import static org.apache.iceberg.types.Types.NestedField.optional;
-import static org.junit.Assert.assertEquals;
import java.util.Collections;
import java.util.function.Supplier;
import org.apache.avro.SchemaBuilder;
import org.apache.iceberg.types.Type;
import org.apache.iceberg.types.Types;
-import org.junit.Test;
+import org.assertj.core.api.Assertions;
+import org.junit.jupiter.api.Test;
public class TestBuildAvroProjection {
@@ -68,11 +68,13 @@ public class TestBuildAvroProjection {
final org.apache.avro.Schema actual = testSubject.array(expected,
supplier);
- assertEquals("Array projection produced undesired array schema", expected,
actual);
- assertEquals(
- "Unexpected element ID discovered on the projected array schema",
- 0,
-
Integer.valueOf(actual.getProp(AvroSchemaUtil.ELEMENT_ID_PROP)).intValue());
+ Assertions.assertThat(actual)
+ .as("Array projection produced undesired array schema")
+ .isEqualTo(expected);
+ Assertions.assertThat(
+
Integer.valueOf(actual.getProp(AvroSchemaUtil.ELEMENT_ID_PROP)).intValue())
+ .as("Unexpected element ID discovered on the projected array schema")
+ .isEqualTo(0);
}
@Test
@@ -141,11 +143,13 @@ public class TestBuildAvroProjection {
final org.apache.avro.Schema actual = testSubject.array(extraField,
supplier);
- assertEquals("Array projection produced undesired array schema", expected,
actual);
- assertEquals(
- "Unexpected element ID discovered on the projected array schema",
- 0,
-
Integer.valueOf(actual.getProp(AvroSchemaUtil.ELEMENT_ID_PROP)).intValue());
+ Assertions.assertThat(actual)
+ .as("Array projection produced undesired array schema")
+ .isEqualTo(expected);
+ Assertions.assertThat(
+
Integer.valueOf(actual.getProp(AvroSchemaUtil.ELEMENT_ID_PROP)).intValue())
+ .as("Unexpected element ID discovered on the projected array schema")
+ .isEqualTo(0);
}
@Test
@@ -202,11 +206,13 @@ public class TestBuildAvroProjection {
final org.apache.avro.Schema actual = testSubject.array(lessField,
supplier);
- assertEquals("Array projection produced undesired array schema", expected,
actual);
- assertEquals(
- "Unexpected element ID discovered on the projected array schema",
- 0,
-
Integer.valueOf(actual.getProp(AvroSchemaUtil.ELEMENT_ID_PROP)).intValue());
+ Assertions.assertThat(actual)
+ .as("Array projection produced undesired array schema")
+ .isEqualTo(expected);
+ Assertions.assertThat(
+
Integer.valueOf(actual.getProp(AvroSchemaUtil.ELEMENT_ID_PROP)).intValue())
+ .as("Unexpected element ID discovered on the projected array schema")
+ .isEqualTo(0);
}
@Test
@@ -250,15 +256,15 @@ public class TestBuildAvroProjection {
final org.apache.avro.Schema actual = testSubject.map(expected, supplier);
- assertEquals("Map projection produced undesired map schema", expected,
actual);
- assertEquals(
- "Unexpected key ID discovered on the projected map schema",
- 0,
-
Integer.valueOf(actual.getProp(AvroSchemaUtil.KEY_ID_PROP)).intValue());
- assertEquals(
- "Unexpected value ID discovered on the projected map schema",
- 1,
-
Integer.valueOf(actual.getProp(AvroSchemaUtil.VALUE_ID_PROP)).intValue());
+ Assertions.assertThat(actual)
+ .as("Map projection produced undesired map schema")
+ .isEqualTo(expected);
+
Assertions.assertThat(Integer.valueOf(actual.getProp(AvroSchemaUtil.KEY_ID_PROP)).intValue())
+ .as("Unexpected key ID discovered on the projected map schema")
+ .isEqualTo(0);
+
Assertions.assertThat(Integer.valueOf(actual.getProp(AvroSchemaUtil.VALUE_ID_PROP)).intValue())
+ .as("Unexpected value ID discovered on the projected map schema")
+ .isEqualTo(1);
}
@Test
@@ -331,15 +337,15 @@ public class TestBuildAvroProjection {
final org.apache.avro.Schema actual = testSubject.map(extraField,
supplier);
- assertEquals("Map projection produced undesired map schema", expected,
actual);
- assertEquals(
- "Unexpected key ID discovered on the projected map schema",
- 0,
-
Integer.valueOf(actual.getProp(AvroSchemaUtil.KEY_ID_PROP)).intValue());
- assertEquals(
- "Unexpected value ID discovered on the projected map schema",
- 1,
-
Integer.valueOf(actual.getProp(AvroSchemaUtil.VALUE_ID_PROP)).intValue());
+ Assertions.assertThat(actual)
+ .as("Map projection produced undesired map schema")
+ .isEqualTo(expected);
+
Assertions.assertThat(Integer.valueOf(actual.getProp(AvroSchemaUtil.KEY_ID_PROP)).intValue())
+ .as("Unexpected key ID discovered on the projected map schema")
+ .isEqualTo(0);
+
Assertions.assertThat(Integer.valueOf(actual.getProp(AvroSchemaUtil.VALUE_ID_PROP)).intValue())
+ .as("Unexpected value ID discovered on the projected map schema")
+ .isEqualTo(1);
}
@Test
@@ -400,14 +406,14 @@ public class TestBuildAvroProjection {
final org.apache.avro.Schema actual = testSubject.map(lessField, supplier);
- assertEquals("Map projection produced undesired map schema", expected,
actual);
- assertEquals(
- "Unexpected key ID discovered on the projected map schema",
- 0,
-
Integer.valueOf(actual.getProp(AvroSchemaUtil.KEY_ID_PROP)).intValue());
- assertEquals(
- "Unexpected value ID discovered on the projected map schema",
- 1,
-
Integer.valueOf(actual.getProp(AvroSchemaUtil.VALUE_ID_PROP)).intValue());
+ Assertions.assertThat(actual)
+ .as("Map projection produced undesired map schema")
+ .isEqualTo(expected);
+
Assertions.assertThat(Integer.valueOf(actual.getProp(AvroSchemaUtil.KEY_ID_PROP)).intValue())
+ .as("Unexpected key ID discovered on the projected map schema")
+ .isEqualTo(0);
+
Assertions.assertThat(Integer.valueOf(actual.getProp(AvroSchemaUtil.VALUE_ID_PROP)).intValue())
+ .as("Unexpected value ID discovered on the projected map schema")
+ .isEqualTo(1);
}
}
diff --git a/core/src/test/java/org/apache/iceberg/avro/TestReadProjection.java
b/core/src/test/java/org/apache/iceberg/avro/TestReadProjection.java
index b6b6c2c967..331e427861 100644
--- a/core/src/test/java/org/apache/iceberg/avro/TestReadProjection.java
+++ b/core/src/test/java/org/apache/iceberg/avro/TestReadProjection.java
@@ -19,6 +19,7 @@
package org.apache.iceberg.avro;
import java.io.IOException;
+import java.nio.file.Path;
import java.util.List;
import java.util.Map;
import org.apache.avro.AvroRuntimeException;
@@ -28,20 +29,17 @@ import org.apache.iceberg.Schema;
import org.apache.iceberg.relocated.com.google.common.collect.ImmutableList;
import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap;
import org.apache.iceberg.relocated.com.google.common.collect.Maps;
-import org.apache.iceberg.relocated.com.google.common.collect.Sets;
import org.apache.iceberg.types.Comparators;
import org.apache.iceberg.types.Types;
import org.assertj.core.api.Assertions;
-import org.junit.Assert;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
public abstract class TestReadProjection {
protected abstract Record writeAndRead(
String desc, Schema writeSchema, Schema readSchema, Record record)
throws IOException;
- @Rule public TemporaryFolder temp = new TemporaryFolder();
+ @TempDir Path temp;
@Test
public void testFullProjection() throws Exception {
@@ -56,10 +54,11 @@ public abstract class TestReadProjection {
Record projected = writeAndRead("full_projection", schema, schema, record);
- Assert.assertEquals("Should contain the correct id value", 34L, (long)
projected.get("id"));
-
+ Assertions.assertThat((Long) projected.get("id"))
+ .as("Should contain the correct id value")
+ .isEqualTo(34L);
int cmp = Comparators.charSequences().compare("test", (CharSequence)
projected.get("data"));
- Assert.assertTrue("Should contain the correct data value", cmp == 0);
+ Assertions.assertThat(cmp).as("Should contain the correct data
value").isEqualTo(0);
}
@Test
@@ -79,9 +78,10 @@ public abstract class TestReadProjection {
Types.NestedField.required(0, "id", Types.LongType.get()));
Record projected = writeAndRead("full_projection", schema, reordered,
record);
-
- Assert.assertEquals("Should contain the correct 0 value", "test",
projected.get(0).toString());
- Assert.assertEquals("Should contain the correct 1 value", 34L,
projected.get(1));
+ Assertions.assertThat(projected.get(0).toString())
+ .as("Should contain the correct 0 value")
+ .isEqualTo("test");
+ Assertions.assertThat(projected.get(1)).as("Should contain the correct 1
value").isEqualTo(34L);
}
@Test
@@ -102,10 +102,11 @@ public abstract class TestReadProjection {
Types.NestedField.optional(3, "missing_2", Types.LongType.get()));
Record projected = writeAndRead("full_projection", schema, reordered,
record);
-
- Assert.assertNull("Should contain the correct 0 value", projected.get(0));
- Assert.assertEquals("Should contain the correct 1 value", "test",
projected.get(1).toString());
- Assert.assertNull("Should contain the correct 2 value", projected.get(2));
+ Assertions.assertThat(projected.get(0)).as("Should contain the correct 0
value").isNull();
+ Assertions.assertThat(projected.get(1).toString())
+ .as("Should contain the correct 1 value")
+ .isEqualTo("test");
+ Assertions.assertThat(projected.get(2)).as("Should contain the correct 2
value").isNull();
}
@Test
@@ -121,7 +122,7 @@ public abstract class TestReadProjection {
Record projected = writeAndRead("empty_projection", schema,
schema.select(), record);
- Assert.assertNotNull("Should read a non-null record", projected);
+ Assertions.assertThat(projected).as("Should read a non-null
record").isNotNull();
// this is expected because there are no values
Assertions.assertThatThrownBy(() -> projected.get(0))
.isInstanceOf(ArrayIndexOutOfBoundsException.class);
@@ -142,7 +143,9 @@ public abstract class TestReadProjection {
Record projected = writeAndRead("basic_projection_id", writeSchema,
idOnly, record);
assertEmptyAvroField(projected, "data");
- Assert.assertEquals("Should contain the correct id value", 34L, (long)
projected.get("id"));
+ Assertions.assertThat((Long) projected.get("id"))
+ .as("Should contain the correct id value")
+ .isEqualTo(34L);
Schema dataOnly = new Schema(Types.NestedField.optional(1, "data",
Types.StringType.get()));
@@ -150,7 +153,7 @@ public abstract class TestReadProjection {
assertEmptyAvroField(projected, "id");
int cmp = Comparators.charSequences().compare("test", (CharSequence)
projected.get("data"));
- Assert.assertEquals("Should contain the correct data value", 0, cmp);
+ Assertions.assertThat(cmp).as("Should contain the correct data
value").isEqualTo(0);
}
@Test
@@ -171,9 +174,11 @@ public abstract class TestReadProjection {
Record projected = writeAndRead("project_and_rename", writeSchema,
readSchema, record);
- Assert.assertEquals("Should contain the correct id value", 34L, (long)
projected.get("id"));
+ Assertions.assertThat((Long) projected.get("id"))
+ .as("Should contain the correct id value")
+ .isEqualTo(34L);
int cmp = Comparators.charSequences().compare("test", (CharSequence)
projected.get("renamed"));
- Assert.assertEquals("Should contain the correct data/renamed value", 0,
cmp);
+ Assertions.assertThat(cmp).as("Should contain the correct data/renamed
value").isEqualTo(0);
}
@Test
@@ -200,7 +205,9 @@ public abstract class TestReadProjection {
Record projected = writeAndRead("id_only", writeSchema, idOnly, record);
assertEmptyAvroField(projected, "location");
- Assert.assertEquals("Should contain the correct id value", 34L, (long)
projected.get("id"));
+ Assertions.assertThat((long) projected.get("id"))
+ .as("Should contain the correct id value")
+ .isEqualTo(34L);
Schema latOnly =
new Schema(
@@ -212,10 +219,11 @@ public abstract class TestReadProjection {
projected = writeAndRead("latitude_only", writeSchema, latOnly, record);
Record projectedLocation = (Record) projected.get("location");
assertEmptyAvroField(projected, "id");
- Assert.assertNotNull("Should project location", projected.get("location"));
+ Assertions.assertThat(projected.get("location")).as("Should project
location").isNotNull();
assertEmptyAvroField(projectedLocation, "long");
- Assert.assertEquals(
- "Should project latitude", 52.995143f, (float)
projectedLocation.get("lat"), 0.000001f);
+ Assertions.assertThat((Float) projectedLocation.get("lat"))
+ .as("Should project latitude")
+ .isCloseTo(52.995143f, Assertions.within(0.000001f));
Schema longOnly =
new Schema(
@@ -227,20 +235,23 @@ public abstract class TestReadProjection {
projected = writeAndRead("longitude_only", writeSchema, longOnly, record);
projectedLocation = (Record) projected.get("location");
assertEmptyAvroField(projected, "id");
- Assert.assertNotNull("Should project location", projected.get("location"));
+ Assertions.assertThat(projected.get("location")).as("Should project
location").isNotNull();
assertEmptyAvroField(projectedLocation, "lat");
- Assert.assertEquals(
- "Should project longitude", -1.539054f, (float)
projectedLocation.get("long"), 0.000001f);
+ Assertions.assertThat((Float) projectedLocation.get("long"))
+ .as("Should project longitude")
+ .isCloseTo(-1.539054f, Assertions.within(0.000001f));
Schema locationOnly = writeSchema.select("location");
projected = writeAndRead("location_only", writeSchema, locationOnly,
record);
projectedLocation = (Record) projected.get("location");
assertEmptyAvroField(projected, "id");
- Assert.assertNotNull("Should project location", projected.get("location"));
- Assert.assertEquals(
- "Should project latitude", 52.995143f, (float)
projectedLocation.get("lat"), 0.000001f);
- Assert.assertEquals(
- "Should project longitude", -1.539054f, (float)
projectedLocation.get("long"), 0.000001f);
+ Assertions.assertThat(projected.get("location")).as("Should project
location").isNotNull();
+ Assertions.assertThat((Float) projectedLocation.get("lat"))
+ .as("Should project latitude")
+ .isCloseTo(52.995143f, Assertions.within(0.000001f));
+ Assertions.assertThat((Float) projectedLocation.get("long"))
+ .as("Should project longitude")
+ .isCloseTo(-1.539054f, Assertions.within(0.000001f));
}
@Test
@@ -262,26 +273,31 @@ public abstract class TestReadProjection {
Schema idOnly = new Schema(Types.NestedField.required(0, "id",
Types.LongType.get()));
Record projected = writeAndRead("id_only", writeSchema, idOnly, record);
- Assert.assertEquals("Should contain the correct id value", 34L, (long)
projected.get("id"));
+ Assertions.assertThat((long) projected.get("id"))
+ .as("Should contain the correct id value")
+ .isEqualTo(34L);
assertEmptyAvroField(projected, "properties");
Schema keyOnly = writeSchema.select("properties.key");
projected = writeAndRead("key_only", writeSchema, keyOnly, record);
assertEmptyAvroField(projected, "id");
- Assert.assertEquals(
- "Should project entire map", properties, toStringMap((Map)
projected.get("properties")));
+ Assertions.assertThat(toStringMap((Map) projected.get("properties")))
+ .as("Should project entire map")
+ .isEqualTo(properties);
Schema valueOnly = writeSchema.select("properties.value");
projected = writeAndRead("value_only", writeSchema, valueOnly, record);
assertEmptyAvroField(projected, "id");
- Assert.assertEquals(
- "Should project entire map", properties, toStringMap((Map)
projected.get("properties")));
+ Assertions.assertThat(toStringMap((Map) projected.get("properties")))
+ .as("Should project entire map")
+ .isEqualTo(properties);
Schema mapOnly = writeSchema.select("properties");
projected = writeAndRead("map_only", writeSchema, mapOnly, record);
assertEmptyAvroField(projected, "id");
- Assert.assertEquals(
- "Should project entire map", properties, toStringMap((Map)
projected.get("properties")));
+ Assertions.assertThat(toStringMap((Map) projected.get("properties")))
+ .as("Should project entire map")
+ .isEqualTo(properties);
}
private Map<String, ?> toStringMap(Map<?, ?> map) {
@@ -329,50 +345,57 @@ public abstract class TestReadProjection {
Schema idOnly = new Schema(Types.NestedField.required(0, "id",
Types.LongType.get()));
Record projected = writeAndRead("id_only", writeSchema, idOnly, record);
- Assert.assertEquals("Should contain the correct id value", 34L, (long)
projected.get("id"));
+ Assertions.assertThat((long) projected.get("id"))
+ .as("Should contain the correct id value")
+ .isEqualTo(34L);
assertEmptyAvroField(projected, "locations");
projected = writeAndRead("all_locations", writeSchema,
writeSchema.select("locations"), record);
assertEmptyAvroField(projected, "id");
- Assert.assertEquals(
- "Should project locations map",
- record.get("locations"),
- toStringMap((Map) projected.get("locations")));
+ Assertions.assertThat(toStringMap((Map) projected.get("locations")))
+ .as("Should project locations map")
+ .isEqualTo(record.get("locations"));
projected = writeAndRead("lat_only", writeSchema,
writeSchema.select("locations.lat"), record);
assertEmptyAvroField(projected, "id");
Map<String, ?> locations = toStringMap((Map) projected.get("locations"));
- Assert.assertNotNull("Should project locations map", locations);
- Assert.assertEquals(
- "Should contain L1 and L2", Sets.newHashSet("L1", "L2"),
locations.keySet());
+ Assertions.assertThat(locations).as("Should project locations
map").isNotNull();
+ Assertions.assertThat(locations.keySet())
+ .as("Should contain L1 and L2")
+ .containsExactly("L1", "L2");
Record projectedL1 = (Record) locations.get("L1");
- Assert.assertNotNull("L1 should not be null", projectedL1);
- Assert.assertEquals(
- "L1 should contain lat", 53.992811f, (float) projectedL1.get("lat"),
0.000001);
+ Assertions.assertThat(projectedL1).as("L1 should not be null").isNotNull();
+ Assertions.assertThat((float) projectedL1.get("lat"))
+ .as("L1 should contain lat")
+ .isCloseTo(53.992811f, Assertions.within(0.000001f));
assertEmptyAvroField(projectedL1, "long");
Record projectedL2 = (Record) locations.get("L2");
- Assert.assertNotNull("L2 should not be null", projectedL2);
- Assert.assertEquals(
- "L2 should contain lat", 52.995143f, (float) projectedL2.get("lat"),
0.000001);
+ Assertions.assertThat(projectedL2).as("L2 should not be null").isNotNull();
+ Assertions.assertThat((float) projectedL2.get("lat"))
+ .as("L2 should contain lat")
+ .isCloseTo(52.995143f, Assertions.within(0.000001f));
assertEmptyAvroField(projectedL2, "y");
projected =
writeAndRead("long_only", writeSchema,
writeSchema.select("locations.long"), record);
assertEmptyAvroField(projected, "id");
locations = toStringMap((Map) projected.get("locations"));
- Assert.assertNotNull("Should project locations map", locations);
- Assert.assertEquals(
- "Should contain L1 and L2", Sets.newHashSet("L1", "L2"),
locations.keySet());
+ Assertions.assertThat(locations).as("Should project locations
map").isNotNull();
+ Assertions.assertThat(locations.keySet())
+ .as("Should contain L1 and L2")
+ .containsExactly("L1", "L2");
projectedL1 = (Record) locations.get("L1");
- Assert.assertNotNull("L1 should not be null", projectedL1);
+ Assertions.assertThat(projectedL1).as("L1 should not be null").isNotNull();
assertEmptyAvroField(projectedL1, "lat");
- Assert.assertEquals(
- "L1 should contain long", -1.542616f, (float) projectedL1.get("long"),
0.000001);
+ Assertions.assertThat((float) projectedL1.get("long"))
+ .as("L1 should contain long")
+ .isCloseTo(-1.542616f, Assertions.within(0.000001f));
projectedL2 = (Record) locations.get("L2");
- Assert.assertNotNull("L2 should not be null", projectedL2);
+ Assertions.assertThat(projectedL2).as("L2 should not be null").isNotNull();
assertEmptyAvroField(projectedL2, "lat");
- Assert.assertEquals(
- "L2 should contain long", -1.539054f, (float) projectedL2.get("long"),
0.000001);
+ Assertions.assertThat((float) projectedL2.get("long"))
+ .as("L2 should contain long")
+ .isCloseTo(-1.539054f, Assertions.within(0.000001f));
Schema latitiudeRenamed =
new Schema(
@@ -389,19 +412,22 @@ public abstract class TestReadProjection {
projected = writeAndRead("latitude_renamed", writeSchema,
latitiudeRenamed, record);
assertEmptyAvroField(projected, "id");
locations = toStringMap((Map) projected.get("locations"));
- Assert.assertNotNull("Should project locations map", locations);
- Assert.assertEquals(
- "Should contain L1 and L2", Sets.newHashSet("L1", "L2"),
locations.keySet());
+ Assertions.assertThat(locations).as("Should project locations
map").isNotNull();
+ Assertions.assertThat(locations.keySet())
+ .as("Should contain L1 and L2")
+ .containsExactly("L1", "L2");
projectedL1 = (Record) locations.get("L1");
- Assert.assertNotNull("L1 should not be null", projectedL1);
- Assert.assertEquals(
- "L1 should contain latitude", 53.992811f, (float)
projectedL1.get("latitude"), 0.000001);
+ Assertions.assertThat(projectedL1).as("L1 should not be null").isNotNull();
+ Assertions.assertThat((float) projectedL1.get("latitude"))
+ .as("L1 should contain latitude")
+ .isCloseTo(53.992811f, Assertions.within(0.000001f));
assertEmptyAvroField(projectedL1, "lat");
assertEmptyAvroField(projectedL1, "long");
projectedL2 = (Record) locations.get("L2");
- Assert.assertNotNull("L2 should not be null", projectedL2);
- Assert.assertEquals(
- "L2 should contain latitude", 52.995143f, (float)
projectedL2.get("latitude"), 0.000001);
+ Assertions.assertThat(projectedL2).as("L2 should not be null").isNotNull();
+ Assertions.assertThat((float) projectedL2.get("latitude"))
+ .as("L2 should contain latitude")
+ .isCloseTo(52.995143f, Assertions.within(0.000001f));
assertEmptyAvroField(projectedL2, "lat");
assertEmptyAvroField(projectedL2, "long");
}
@@ -423,18 +449,24 @@ public abstract class TestReadProjection {
Schema idOnly = new Schema(Types.NestedField.required(0, "id",
Types.LongType.get()));
Record projected = writeAndRead("id_only", writeSchema, idOnly, record);
- Assert.assertEquals("Should contain the correct id value", 34L, (long)
projected.get("id"));
+ Assertions.assertThat((long) projected.get("id"))
+ .as("Should contain the correct id value")
+ .isEqualTo(34L);
assertEmptyAvroField(projected, "values");
Schema elementOnly = writeSchema.select("values.element");
projected = writeAndRead("element_only", writeSchema, elementOnly, record);
assertEmptyAvroField(projected, "id");
- Assert.assertEquals("Should project entire list", values,
projected.get("values"));
+ Assertions.assertThat(projected.get("values"))
+ .as("Should project entire list")
+ .isEqualTo(values);
Schema listOnly = writeSchema.select("values");
projected = writeAndRead("list_only", writeSchema, listOnly, record);
assertEmptyAvroField(projected, "id");
- Assert.assertEquals("Should project entire list", values,
projected.get("values"));
+ Assertions.assertThat(projected.get("values"))
+ .as("Should project entire list")
+ .isEqualTo(values);
}
@Test
@@ -469,37 +501,40 @@ public abstract class TestReadProjection {
Schema idOnly = new Schema(Types.NestedField.required(0, "id",
Types.LongType.get()));
Record projected = writeAndRead("id_only", writeSchema, idOnly, record);
- Assert.assertEquals("Should contain the correct id value", 34L, (long)
projected.get("id"));
+ Assertions.assertThat((long) projected.get("id"))
+ .as("Should contain the correct id value")
+ .isEqualTo(34L);
assertEmptyAvroField(projected, "points");
projected = writeAndRead("all_points", writeSchema,
writeSchema.select("points"), record);
assertEmptyAvroField(projected, "id");
- Assert.assertEquals(
- "Should project points list", record.get("points"),
projected.get("points"));
+ Assertions.assertThat(projected.get("points"))
+ .as("Should project points list")
+ .isEqualTo(record.get("points"));
projected = writeAndRead("x_only", writeSchema,
writeSchema.select("points.x"), record);
assertEmptyAvroField(projected, "id");
- Assert.assertNotNull("Should project points list",
projected.get("points"));
+ Assertions.assertThat(projected.get("points")).as("Should project points
list").isNotNull();
List<Record> points = (List<Record>) projected.get("points");
- Assert.assertEquals("Should read 2 points", 2, points.size());
+ Assertions.assertThat(points).as("Should read 2 points").hasSize(2);
Record projectedP1 = points.get(0);
- Assert.assertEquals("Should project x", 1, (int) projectedP1.get("x"));
+ Assertions.assertThat((int) projectedP1.get("x")).as("Should project
x").isEqualTo(1);
assertEmptyAvroField(projectedP1, "y");
Record projectedP2 = points.get(1);
- Assert.assertEquals("Should project x", 3, (int) projectedP2.get("x"));
+ Assertions.assertThat((int) projectedP2.get("x")).as("Should project
x").isEqualTo(3);
assertEmptyAvroField(projectedP2, "y");
projected = writeAndRead("y_only", writeSchema,
writeSchema.select("points.y"), record);
assertEmptyAvroField(projected, "id");
- Assert.assertNotNull("Should project points list",
projected.get("points"));
+ Assertions.assertThat(projected.get("points")).as("Should project points
list").isNotNull();
points = (List<Record>) projected.get("points");
- Assert.assertEquals("Should read 2 points", 2, points.size());
+ Assertions.assertThat(points).as("Should read 2 points").hasSize(2);
projectedP1 = points.get(0);
assertEmptyAvroField(projectedP1, "x");
- Assert.assertEquals("Should project y", 2, (int) projectedP1.get("y"));
+ Assertions.assertThat((int) projectedP1.get("y")).as("Should project
y").isEqualTo(2);
projectedP2 = points.get(1);
assertEmptyAvroField(projectedP2, "x");
- Assert.assertEquals("Should project null y", null, projectedP2.get("y"));
+ Assertions.assertThat(projectedP2.get("y")).as("Should project null
y").isNull();
Schema yRenamed =
new Schema(
@@ -513,17 +548,17 @@ public abstract class TestReadProjection {
projected = writeAndRead("y_renamed", writeSchema, yRenamed, record);
assertEmptyAvroField(projected, "id");
- Assert.assertNotNull("Should project points list",
projected.get("points"));
+ Assertions.assertThat(projected.get("points")).as("Should project points
list").isNotNull();
points = (List<Record>) projected.get("points");
- Assert.assertEquals("Should read 2 points", 2, points.size());
+ Assertions.assertThat(points).as("Should read 2 points").hasSize(2);
projectedP1 = points.get(0);
assertEmptyAvroField(projectedP1, "x");
assertEmptyAvroField(projectedP1, "y");
- Assert.assertEquals("Should project z", 2, (int) projectedP1.get("z"));
+ Assertions.assertThat((int) projectedP1.get("z")).as("Should project
z").isEqualTo(2);
projectedP2 = points.get(1);
assertEmptyAvroField(projectedP2, "x");
assertEmptyAvroField(projectedP2, "y");
- Assert.assertNull("Should project null z", projectedP2.get("z"));
+ Assertions.assertThat(projectedP2.get("z")).as("Should project null
z").isNull();
}
@Test
@@ -553,8 +588,10 @@ public abstract class TestReadProjection {
assertEmptyAvroField(projected, "id");
Record result = (Record) projected.get("location");
- Assert.assertEquals("location should be in the 0th position", result,
projected.get(0));
- Assert.assertNotNull("Should contain an empty record", result);
+ Assertions.assertThat(projected.get(0))
+ .as("location should be in the 0th position")
+ .isEqualTo(result);
+ Assertions.assertThat(result).as("Should contain an empty
record").isNotNull();
assertEmptyAvroField(result, "lat");
assertEmptyAvroField(result, "long");
}
@@ -584,8 +621,10 @@ public abstract class TestReadProjection {
Record projected = writeAndRead("empty_req_proj", writeSchema,
emptyStruct, record);
assertEmptyAvroField(projected, "id");
Record result = (Record) projected.get("location");
- Assert.assertEquals("location should be in the 0th position", result,
projected.get(0));
- Assert.assertNotNull("Should contain an empty record", result);
+ Assertions.assertThat(projected.get(0))
+ .as("location should be in the 0th position")
+ .isEqualTo(result);
+ Assertions.assertThat(result).as("Should contain an empty
record").isNotNull();
assertEmptyAvroField(result, "lat");
assertEmptyAvroField(result, "long");
}
@@ -620,16 +659,21 @@ public abstract class TestReadProjection {
Types.NestedField.required(4, "empty",
Types.StructType.of()))));
Record projected = writeAndRead("req_empty_req_proj", writeSchema,
emptyStruct, record);
- Assert.assertEquals("Should project id", 34L, projected.get("id"));
+ Assertions.assertThat(projected.get("id")).as("Should project
id").isEqualTo(34L);
Record result = (Record) projected.get("location");
- Assert.assertEquals("location should be in the 1st position", result,
projected.get(1));
- Assert.assertNotNull("Should contain an empty record", result);
+ Assertions.assertThat(projected.get(1))
+ .as("location should be in the 1st position")
+ .isEqualTo(result);
+ Assertions.assertThat(result).as("Should contain an empty
record").isNotNull();
assertEmptyAvroField(result, "lat");
assertEmptyAvroField(result, "long");
- Assert.assertNotNull("Should project empty",
result.getSchema().getField("empty"));
- Assert.assertNotNull("Empty should not be null", result.get("empty"));
- Assert.assertEquals(
- "Empty should be empty", 0, ((Record)
result.get("empty")).getSchema().getFields().size());
+ Assertions.assertThat(result.getSchema().getField("empty"))
+ .as("Should project empty")
+ .isNotNull();
+ Assertions.assertThat(result.get("empty")).as("Empty should not be
null").isNotNull();
+ Assertions.assertThat(((Record)
result.get("empty")).getSchema().getFields())
+ .as("Empty should be empty")
+ .isEmpty();
}
@Test
@@ -670,12 +714,16 @@ public abstract class TestReadProjection {
Record projected = writeAndRead("nested_empty_proj", writeSchema,
emptyStruct, record);
assertEmptyAvroField(projected, "id");
Record outerResult = (Record) projected.get("outer");
- Assert.assertEquals("Outer should be in the 0th position", outerResult,
projected.get(0));
- Assert.assertNotNull("Should contain the outer record", outerResult);
+ Assertions.assertThat(projected.get(0))
+ .as("Outer should be in the 0th position")
+ .isEqualTo(outerResult);
+ Assertions.assertThat(outerResult).as("Should contain the outer
record").isNotNull();
assertEmptyAvroField(outerResult, "lat");
Record innerResult = (Record) outerResult.get("inner");
- Assert.assertEquals("Inner should be in the 0th position", innerResult,
outerResult.get(0));
- Assert.assertNotNull("Should contain the inner record", innerResult);
+ Assertions.assertThat(outerResult.get(0))
+ .as("Inner should be in the 0th position")
+ .isEqualTo(innerResult);
+ Assertions.assertThat(innerResult).as("Should contain the inner
record").isNotNull();
assertEmptyAvroField(innerResult, "lon");
}
@@ -715,12 +763,16 @@ public abstract class TestReadProjection {
Record projected = writeAndRead("nested_empty_req_proj", writeSchema,
emptyStruct, record);
assertEmptyAvroField(projected, "id");
Record outerResult = (Record) projected.get("outer");
- Assert.assertEquals("Outer should be in the 0th position", outerResult,
projected.get(0));
- Assert.assertNotNull("Should contain the outer record", outerResult);
+ Assertions.assertThat(projected.get(0))
+ .as("Outer should be in the 0th position")
+ .isEqualTo(outerResult);
+ Assertions.assertThat(outerResult).as("Should contain the outer
record").isNotNull();
assertEmptyAvroField(outerResult, "lat");
Record innerResult = (Record) outerResult.get("inner");
- Assert.assertEquals("Inner should be in the 0th position", innerResult,
outerResult.get(0));
- Assert.assertNotNull("Should contain the inner record", innerResult);
+ Assertions.assertThat(outerResult.get(0))
+ .as("Inner should be in the 0th position")
+ .isEqualTo(innerResult);
+ Assertions.assertThat(innerResult).as("Should contain the inner
record").isNotNull();
assertEmptyAvroField(innerResult, "lon");
}
diff --git
a/core/src/test/java/org/apache/iceberg/data/avro/TestDecoderResolver.java
b/core/src/test/java/org/apache/iceberg/data/avro/TestDecoderResolver.java
index 5855e80998..9b355464a9 100644
--- a/core/src/test/java/org/apache/iceberg/data/avro/TestDecoderResolver.java
+++ b/core/src/test/java/org/apache/iceberg/data/avro/TestDecoderResolver.java
@@ -30,12 +30,12 @@ import org.apache.iceberg.ManifestFile;
import org.apache.iceberg.avro.AvroSchemaUtil;
import org.apache.iceberg.relocated.com.google.common.collect.Sets;
import org.awaitility.Awaitility;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class TestDecoderResolver {
- @Before
+ @BeforeEach
public void before() {
DecoderResolver.DECODER_CACHES.get().clear();
}
@@ -47,8 +47,8 @@ public class TestDecoderResolver {
ResolvingDecoder resolvingDecoder =
DecoderResolver.resolve(dummyDecoder, fileSchema, fileSchema);
- assertThat(DecoderResolver.DECODER_CACHES.get().size()).isEqualTo(1);
-
assertThat(DecoderResolver.DECODER_CACHES.get().get(fileSchema).size()).isEqualTo(1);
+ assertThat(DecoderResolver.DECODER_CACHES.get()).hasSize(1);
+
assertThat(DecoderResolver.DECODER_CACHES.get().get(fileSchema)).hasSize(1);
checkCached(fileSchema, fileSchema);
// Equal but new one
@@ -58,8 +58,8 @@ public class TestDecoderResolver {
DecoderResolver.resolve(dummyDecoder, fileSchema1, fileSchema1);
assertThat(resolvingDecoder1).isNotSameAs(resolvingDecoder);
- assertThat(DecoderResolver.DECODER_CACHES.get().size()).isEqualTo(2);
-
assertThat(DecoderResolver.DECODER_CACHES.get().get(fileSchema1).size()).isEqualTo(1);
+ assertThat(DecoderResolver.DECODER_CACHES.get()).hasSize(2);
+
assertThat(DecoderResolver.DECODER_CACHES.get().get(fileSchema1)).hasSize(1);
checkCached(fileSchema1, fileSchema1);
// New one
@@ -68,8 +68,8 @@ public class TestDecoderResolver {
DecoderResolver.resolve(dummyDecoder, fileSchema2, fileSchema2);
assertThat(resolvingDecoder2).isNotSameAs(resolvingDecoder);
- assertThat(DecoderResolver.DECODER_CACHES.get().size()).isEqualTo(3);
-
assertThat(DecoderResolver.DECODER_CACHES.get().get(fileSchema2).size()).isEqualTo(1);
+ assertThat(DecoderResolver.DECODER_CACHES.get()).hasSize(3);
+
assertThat(DecoderResolver.DECODER_CACHES.get().get(fileSchema2)).hasSize(1);
checkCached(fileSchema2, fileSchema2);
checkCachedSize(3);
@@ -92,8 +92,8 @@ public class TestDecoderResolver {
ResolvingDecoder resolvingDecoder =
DecoderResolver.resolve(dummyDecoder, readSchema, fileSchema);
- assertThat(DecoderResolver.DECODER_CACHES.get().size()).isEqualTo(1);
-
assertThat(DecoderResolver.DECODER_CACHES.get().get(readSchema).size()).isEqualTo(1);
+ assertThat(DecoderResolver.DECODER_CACHES.get()).hasSize(1);
+
assertThat(DecoderResolver.DECODER_CACHES.get().get(readSchema)).hasSize(1);
checkCached(readSchema, fileSchema);
// Equal but new one
@@ -105,8 +105,8 @@ public class TestDecoderResolver {
DecoderResolver.resolve(dummyDecoder, readSchema1, fileSchema1);
assertThat(resolvingDecoder1).isNotSameAs(resolvingDecoder);
- assertThat(DecoderResolver.DECODER_CACHES.get().size()).isEqualTo(2);
-
assertThat(DecoderResolver.DECODER_CACHES.get().get(readSchema1).size()).isEqualTo(1);
+ assertThat(DecoderResolver.DECODER_CACHES.get()).hasSize(2);
+
assertThat(DecoderResolver.DECODER_CACHES.get().get(readSchema1)).hasSize(1);
checkCached(readSchema1, fileSchema1);
// New read schema
@@ -115,8 +115,8 @@ public class TestDecoderResolver {
DecoderResolver.resolve(dummyDecoder, readSchema2, fileSchema);
assertThat(resolvingDecoder2).isNotSameAs(resolvingDecoder);
- assertThat(DecoderResolver.DECODER_CACHES.get().size()).isEqualTo(3);
-
assertThat(DecoderResolver.DECODER_CACHES.get().get(readSchema2).size()).isEqualTo(1);
+ assertThat(DecoderResolver.DECODER_CACHES.get()).hasSize(3);
+
assertThat(DecoderResolver.DECODER_CACHES.get().get(readSchema2)).hasSize(1);
checkCached(readSchema2, fileSchema);
checkCachedSize(3);