Skip to content

Commit

Permalink
update to junit5
Browse files Browse the repository at this point in the history
  • Loading branch information
chinmay-bhat committed Dec 20, 2023
1 parent 1082465 commit 08e6302
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.apache.iceberg.types.Types;
import org.apache.iceberg.util.StructLikeWrapper;
import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Test;

public abstract class RecordWrapperTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package org.apache.iceberg.spark.source;

import static org.assertj.core.api.Assertions.assertThat;

import java.util.Iterator;
import org.apache.iceberg.RecordWrapperTest;
import org.apache.iceberg.Schema;
Expand All @@ -29,18 +31,17 @@
import org.apache.iceberg.spark.data.RandomData;
import org.apache.iceberg.util.StructLikeWrapper;
import org.apache.spark.sql.catalyst.InternalRow;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.jupiter.api.Disabled;

public class TestInternalRowWrapper extends RecordWrapperTest {

@Ignore
@Disabled
@Override
public void testTimestampWithoutZone() {
// Spark does not support timestamp without zone.
}

@Ignore
@Disabled
@Override
public void testTime() {
// Spark does not support time fields.
Expand All @@ -61,8 +62,8 @@ protected void generateAndValidate(Schema schema, AssertMethod assertMethod) {
StructLikeWrapper actualWrapper = StructLikeWrapper.forType(schema.asStruct());
StructLikeWrapper expectedWrapper = StructLikeWrapper.forType(schema.asStruct());
for (int i = 0; i < numRecords; i++) {
Assert.assertTrue("Should have more records", actual.hasNext());
Assert.assertTrue("Should have more InternalRow", expected.hasNext());
assertThat(actual).as("Should have more records").hasNext();
assertThat(expected).as("Should have more InternalRow").hasNext();

StructLike recordStructLike = recordWrapper.wrap(actual.next());
StructLike rowStructLike = rowWrapper.wrap(expected.next());
Expand All @@ -73,7 +74,7 @@ protected void generateAndValidate(Schema schema, AssertMethod assertMethod) {
expectedWrapper.set(rowStructLike));
}

Assert.assertFalse("Shouldn't have more record", actual.hasNext());
Assert.assertFalse("Shouldn't have more InternalRow", expected.hasNext());
assertThat(actual).as("Shouldn't have more record").isExhausted();
assertThat(expected).as("Shouldn't have more InternalRow").isExhausted();
}
}

0 comments on commit 08e6302

Please sign in to comment.