Skip to content

Commit

Permalink
Use ParameterizedTest in junit5.
Browse files Browse the repository at this point in the history
  • Loading branch information
liujia10 committed Jul 25, 2022
1 parent 8958619 commit aafe8a0
Showing 1 changed file with 8 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@

import org.apache.hadoop.conf.Configuration;
import org.apache.orc.CompressionKind;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.junit.jupiter.api.io.TempDir;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.EnumSource;

import java.io.File;
import java.util.Arrays;
Expand All @@ -41,23 +41,16 @@
/** Unit test for the ORC BulkWriter implementation. */
public class OrcBulkWriterTest {

@ClassRule public static final TemporaryFolder TEMPORARY_FOLDER = new TemporaryFolder();
@TempDir private java.nio.file.Path tempDir;

private final String schema = "struct<_col0:string,_col1:int>";
private final List<Record> input =
Arrays.asList(new Record("Shiv", 44), new Record("Jesse", 23), new Record("Walt", 50));

@Test
public void testOrcBulkWriter() throws Exception {
writeOrcFileWithCodec(CompressionKind.LZ4);
writeOrcFileWithCodec(CompressionKind.SNAPPY);
writeOrcFileWithCodec(CompressionKind.ZLIB);
writeOrcFileWithCodec(CompressionKind.LZO);
writeOrcFileWithCodec(CompressionKind.ZSTD);
}

private void writeOrcFileWithCodec(CompressionKind codec) throws Exception {
final File outDir = TEMPORARY_FOLDER.newFolder();
@ParameterizedTest
@EnumSource(CompressionKind.class)
public void writeOrcFileWithCodec(CompressionKind codec) throws Exception {
final File outDir = tempDir.toFile();
final Properties writerProps = new Properties();
writerProps.setProperty("orc.compress", codec.name());

Expand Down

0 comments on commit aafe8a0

Please sign in to comment.