From b3c9b677921636edeef27186a0c0d07fa2348ebb Mon Sep 17 00:00:00 2001 From: Thomas Gantenbein Date: Thu, 26 Sep 2024 23:52:31 +0200 Subject: [PATCH] Remove deprecated doPreSetup/doPostSetup methods and some cosmetic edits --- .../tarfile/SpringTarFileDataFormatTest.java | 23 ++++++------ .../tarfile/SpringTarSplitterRouteTest.java | 4 +- .../tarfile/TarFileDataFormatTest.java | 37 ++++++++++--------- .../tarfile/TarFileSplitAndDeleteTest.java | 11 +++--- .../TarFileSplitIteratorCorruptTest.java | 4 +- .../tarfile/TarSplitterRouteIssueTest.java | 11 +++--- ...egationStrategyWithFilenameHeaderTest.java | 11 +++--- ...gregationStrategyWithPreservationTest.java | 9 +++-- ...AggregationStrategyEmptyFirstFileTest.java | 19 +++++----- .../tarfile/TarAggregationStrategyTest.java | 9 +++-- 10 files changed, 73 insertions(+), 65 deletions(-) diff --git a/components/camel-tarfile/src/test/java/org/apache/camel/dataformat/tarfile/SpringTarFileDataFormatTest.java b/components/camel-tarfile/src/test/java/org/apache/camel/dataformat/tarfile/SpringTarFileDataFormatTest.java index 18c4f600ad797..7932fc0d4fff6 100644 --- a/components/camel-tarfile/src/test/java/org/apache/camel/dataformat/tarfile/SpringTarFileDataFormatTest.java +++ b/components/camel-tarfile/src/test/java/org/apache/camel/dataformat/tarfile/SpringTarFileDataFormatTest.java @@ -25,6 +25,7 @@ import org.apache.camel.builder.NotifyBuilder; import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.test.spring.junit5.CamelSpringTestSupport; +import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; import org.springframework.context.support.ClassPathXmlApplicationContext; @@ -40,11 +41,11 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class SpringTarFileDataFormatTest extends CamelSpringTestSupport { +class SpringTarFileDataFormatTest extends CamelSpringTestSupport { private static final File TEST_DIR = new File("target/springtar"); @Test - public void testTarWithoutFileName() throws Exception { + void testTarWithoutFileName() throws Exception { MockEndpoint mock = getMockEndpoint("mock:tar"); mock.expectedMessageCount(1); @@ -65,7 +66,7 @@ public void testTarWithoutFileName() throws Exception { } @Test - public void testTarWithFileName() throws Exception { + void testTarWithFileName() throws Exception { MockEndpoint mock = getMockEndpoint("mock:tar"); mock.expectedMessageCount(1); mock.expectedHeaderReceived(FILE_NAME, "poem.txt.tar"); @@ -87,7 +88,7 @@ public void testTarWithFileName() throws Exception { } @Test - public void testUntar() throws Exception { + void testUntar() throws Exception { getMockEndpoint("mock:untar").expectedBodiesReceived(TEXT); getMockEndpoint("mock:untar").expectedHeaderReceived(FILE_NAME, "file"); @@ -97,7 +98,7 @@ public void testUntar() throws Exception { } @Test - public void testTarAndUntar() throws Exception { + void testTarAndUntar() throws Exception { MockEndpoint mock = getMockEndpoint("mock:tarAndUntar"); mock.expectedMessageCount(1); @@ -111,7 +112,7 @@ public void testTarAndUntar() throws Exception { } @Test - public void testTarToFileWithoutFileName() throws Exception { + void testTarToFileWithoutFileName() throws Exception { NotifyBuilder notify = new NotifyBuilder(context).whenDone(1).create(); String[] files = TEST_DIR.list(); @@ -142,7 +143,7 @@ public void testTarToFileWithoutFileName() throws Exception { } @Test - public void testTarToFileWithFileName() throws Exception { + void testTarToFileWithFileName() throws Exception { NotifyBuilder notify = new NotifyBuilder(context).whenDone(1).create(); MockEndpoint mock = getMockEndpoint("mock:tarToFile"); @@ -172,7 +173,7 @@ public void testTarToFileWithFileName() throws Exception { } @Test - public void testDslTar() throws Exception { + void testDslTar() throws Exception { getMockEndpoint("mock:dslTar").expectedHeaderReceived(FILE_NAME, "poem.txt.tar"); template.sendBodyAndHeader("direct:dslTar", TEXT, FILE_NAME, "poem.txt"); @@ -181,7 +182,7 @@ public void testDslTar() throws Exception { } @Test - public void testDslUntar() throws Exception { + void testDslUntar() throws Exception { getMockEndpoint("mock:dslUntar").expectedBodiesReceived(TEXT); getMockEndpoint("mock:dslUntar").expectedHeaderReceived(FILE_NAME, "test.txt"); @@ -190,8 +191,8 @@ public void testDslUntar() throws Exception { MockEndpoint.assertIsSatisfied(context); } - @Override - public void doPostSetup() { + @AfterEach + public void cleanOutputDirectory() { deleteDirectory(TEST_DIR); } diff --git a/components/camel-tarfile/src/test/java/org/apache/camel/dataformat/tarfile/SpringTarSplitterRouteTest.java b/components/camel-tarfile/src/test/java/org/apache/camel/dataformat/tarfile/SpringTarSplitterRouteTest.java index 0b7831a2fde43..d7b32b21f0c4c 100644 --- a/components/camel-tarfile/src/test/java/org/apache/camel/dataformat/tarfile/SpringTarSplitterRouteTest.java +++ b/components/camel-tarfile/src/test/java/org/apache/camel/dataformat/tarfile/SpringTarSplitterRouteTest.java @@ -21,10 +21,10 @@ import org.junit.jupiter.api.Test; import org.springframework.context.support.ClassPathXmlApplicationContext; -public class SpringTarSplitterRouteTest extends CamelSpringTestSupport { +class SpringTarSplitterRouteTest extends CamelSpringTestSupport { @Test - public void testSplitter() throws InterruptedException { + void testSplitter() throws InterruptedException { MockEndpoint processTarEntry = getMockEndpoint("mock:processTarEntry"); processTarEntry.expectedBodiesReceivedInAnyOrder("chau", "hi", "hola", "hello", "greetings"); diff --git a/components/camel-tarfile/src/test/java/org/apache/camel/dataformat/tarfile/TarFileDataFormatTest.java b/components/camel-tarfile/src/test/java/org/apache/camel/dataformat/tarfile/TarFileDataFormatTest.java index 0f8de0324aa16..115ec33930190 100644 --- a/components/camel-tarfile/src/test/java/org/apache/camel/dataformat/tarfile/TarFileDataFormatTest.java +++ b/components/camel-tarfile/src/test/java/org/apache/camel/dataformat/tarfile/TarFileDataFormatTest.java @@ -40,6 +40,7 @@ import org.apache.commons.compress.archivers.ArchiveStreamFactory; import org.apache.commons.compress.archivers.tar.TarArchiveEntry; import org.apache.commons.compress.archivers.tar.TarArchiveInputStream; +import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; import static org.apache.camel.Exchange.FILE_NAME; @@ -56,13 +57,13 @@ /** * Unit tests for {@link TarFileDataFormat}. */ -public class TarFileDataFormatTest extends CamelTestSupport { +class TarFileDataFormatTest extends CamelTestSupport { private static final File TEST_DIR = new File("target/tar"); private TarFileDataFormat tar; @Test - public void testTarWithoutFileName() throws Exception { + void testTarWithoutFileName() throws Exception { MockEndpoint mock = getMockEndpoint("mock:tar"); mock.expectedMessageCount(1); @@ -84,7 +85,7 @@ public void testTarWithoutFileName() throws Exception { } @Test - public void testTarWithFileName() throws Exception { + void testTarWithFileName() throws Exception { MockEndpoint mock = getMockEndpoint("mock:tar"); mock.expectedMessageCount(1); mock.expectedHeaderReceived(FILE_NAME, "poem.txt.tar"); @@ -106,7 +107,7 @@ public void testTarWithFileName() throws Exception { } @Test - public void testTarWithPathElements() throws Exception { + void testTarWithPathElements() throws Exception { MockEndpoint mock = getMockEndpoint("mock:tar"); mock.expectedMessageCount(1); mock.expectedHeaderReceived(FILE_NAME, "poem.txt.tar"); @@ -127,7 +128,7 @@ public void testTarWithPathElements() throws Exception { } @Test - public void testTarWithPreservedPathElements() throws Exception { + void testTarWithPreservedPathElements() throws Exception { MockEndpoint mock = getMockEndpoint("mock:tar"); mock.expectedMessageCount(1); mock.expectedHeaderReceived(FILE_NAME, "poem.txt.tar"); @@ -155,7 +156,7 @@ public void testTarWithPreservedPathElements() throws Exception { } @Test - public void testUntar() throws Exception { + void testUntar() throws Exception { getMockEndpoint("mock:untar").expectedBodiesReceived(TEXT); getMockEndpoint("mock:untar").expectedHeaderReceived(FILE_NAME, "file"); @@ -165,7 +166,7 @@ public void testUntar() throws Exception { } @Test - public void testUntarWithCorruptedTarFile() { + void testUntarWithCorruptedTarFile() { final File body = new File("src/test/resources/data/corrupt.tar"); assertThrows(CamelExecutionException.class, @@ -173,7 +174,7 @@ public void testUntarWithCorruptedTarFile() { } @Test - public void testTarAndUntar() throws Exception { + void testTarAndUntar() throws Exception { MockEndpoint mock = getMockEndpoint("mock:tarAndUntar"); mock.expectedMessageCount(1); @@ -187,7 +188,7 @@ public void testTarAndUntar() throws Exception { } @Test - public void testTarToFileWithoutFileName() throws Exception { + void testTarToFileWithoutFileName() throws Exception { NotifyBuilder notify = new NotifyBuilder(context).whenDone(1).create(); String[] files = TEST_DIR.list(); @@ -218,7 +219,7 @@ public void testTarToFileWithoutFileName() throws Exception { } @Test - public void testTarToFileWithFileName() throws Exception { + void testTarToFileWithFileName() throws Exception { NotifyBuilder notify = new NotifyBuilder(context).whenDone(1).create(); MockEndpoint mock = getMockEndpoint("mock:tarToFile"); @@ -249,7 +250,7 @@ public void testTarToFileWithFileName() throws Exception { } @Test - public void testDslTar() throws Exception { + void testDslTar() throws Exception { getMockEndpoint("mock:dslTar").expectedHeaderReceived(FILE_NAME, "poem.txt.tar"); template.sendBodyAndHeader("direct:dslTar", TEXT, FILE_NAME, "poem.txt"); @@ -258,7 +259,7 @@ public void testDslTar() throws Exception { } @Test - public void testDslUntar() throws Exception { + void testDslUntar() throws Exception { getMockEndpoint("mock:dslUntar").expectedBodiesReceived(TEXT); getMockEndpoint("mock:dslUntar").expectedHeaderReceived(FILE_NAME, "test.txt"); @@ -268,7 +269,7 @@ public void testDslUntar() throws Exception { } @Test - public void testUntarWithEmptyDirectorySupported() { + void testUntarWithEmptyDirectorySupported() { deleteDirectory(new File("hello_out")); tar.setUsingIterator(true); tar.setAllowEmptyDirectory(true); @@ -278,7 +279,7 @@ public void testUntarWithEmptyDirectorySupported() { } @Test - public void testUntarWithEmptyDirectoryUnsupported() { + void testUntarWithEmptyDirectoryUnsupported() { deleteDirectory(new File("hello_out")); tar.setUsingIterator(true); tar.setAllowEmptyDirectory(false); @@ -288,7 +289,7 @@ public void testUntarWithEmptyDirectoryUnsupported() { } @Test - public void testUnzipMaxDecompressedSize() throws Exception { + void testUnzipMaxDecompressedSize() throws Exception { final byte[] files = getTaredText("file"); // We are only allowing 10 bytes to be decompressed, so we expect an error @@ -296,8 +297,8 @@ public void testUnzipMaxDecompressedSize() throws Exception { () -> template.sendBody("direct:untarMaxDecompressedSize", files)); } - @Override - public void doPostSetup() { + @AfterEach + public void cleanOutputDirectory() { deleteDirectory(TEST_DIR); } @@ -352,7 +353,7 @@ public void process(Exchange exchange) throws Exception { } else { outputFile.getParentFile().mkdirs(); try (TarArchiveInputStream debInputStream - = (TarArchiveInputStream) new ArchiveStreamFactory().createArchiveInputStream("tar", + = new ArchiveStreamFactory().createArchiveInputStream("tar", is)) { copy(debInputStream, outputFile); } diff --git a/components/camel-tarfile/src/test/java/org/apache/camel/dataformat/tarfile/TarFileSplitAndDeleteTest.java b/components/camel-tarfile/src/test/java/org/apache/camel/dataformat/tarfile/TarFileSplitAndDeleteTest.java index 6fce25b90c71f..0345c724781e3 100644 --- a/components/camel-tarfile/src/test/java/org/apache/camel/dataformat/tarfile/TarFileSplitAndDeleteTest.java +++ b/components/camel-tarfile/src/test/java/org/apache/camel/dataformat/tarfile/TarFileSplitAndDeleteTest.java @@ -29,21 +29,22 @@ import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.test.junit5.CamelTestSupport; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import static org.apache.camel.test.junit5.TestSupport.deleteDirectory; import static org.junit.jupiter.api.Assertions.assertFalse; -public class TarFileSplitAndDeleteTest extends CamelTestSupport { +class TarFileSplitAndDeleteTest extends CamelTestSupport { - @Override - public void doPreSetup() { + @BeforeEach + public void cleanOutputDirectories() { deleteDirectory("target/testDeleteTarFileWhenUnmarshalWithDataFormat"); deleteDirectory("target/testDeleteTarFileWhenUnmarshalWithSplitter"); } @Test - public void testDeleteTarFileWhenUnmarshalWithDataFormat() throws Exception { + void testDeleteTarFileWhenUnmarshalWithDataFormat() throws Exception { NotifyBuilder notify = new NotifyBuilder(context) .from("file://target/" + "testDeleteTarFileWhenUnmarshalWithDataFormat").whenDone(1).create(); getMockEndpoint("mock:end").expectedMessageCount(3); @@ -58,7 +59,7 @@ public void testDeleteTarFileWhenUnmarshalWithDataFormat() throws Exception { } @Test - public void testDeleteTarFileWhenUnmarshalWithSplitter() throws Exception { + void testDeleteTarFileWhenUnmarshalWithSplitter() throws Exception { NotifyBuilder notify = new NotifyBuilder(context).from("file://target/" + "testDeleteTarFileWhenUnmarshalWithSplitter") .whenDone(1).create(); getMockEndpoint("mock:end").expectedMessageCount(3); diff --git a/components/camel-tarfile/src/test/java/org/apache/camel/dataformat/tarfile/TarFileSplitIteratorCorruptTest.java b/components/camel-tarfile/src/test/java/org/apache/camel/dataformat/tarfile/TarFileSplitIteratorCorruptTest.java index ad7ae26b7b945..f68c6543d3323 100644 --- a/components/camel-tarfile/src/test/java/org/apache/camel/dataformat/tarfile/TarFileSplitIteratorCorruptTest.java +++ b/components/camel-tarfile/src/test/java/org/apache/camel/dataformat/tarfile/TarFileSplitIteratorCorruptTest.java @@ -25,10 +25,10 @@ import org.apache.camel.test.junit5.CamelTestSupport; import org.junit.jupiter.api.Test; -public class TarFileSplitIteratorCorruptTest extends CamelTestSupport { +class TarFileSplitIteratorCorruptTest extends CamelTestSupport { @Test - public void testTarFileUnmarshal() throws Exception { + void testTarFileUnmarshal() throws Exception { getMockEndpoint("mock:dead").expectedMessageCount(1); getMockEndpoint("mock:dead").message(0).exchangeProperty(Exchange.EXCEPTION_CAUGHT) .isInstanceOf(IllegalStateException.class); diff --git a/components/camel-tarfile/src/test/java/org/apache/camel/dataformat/tarfile/TarSplitterRouteIssueTest.java b/components/camel-tarfile/src/test/java/org/apache/camel/dataformat/tarfile/TarSplitterRouteIssueTest.java index 43fa5db3e5a36..ca00cd17fcbeb 100644 --- a/components/camel-tarfile/src/test/java/org/apache/camel/dataformat/tarfile/TarSplitterRouteIssueTest.java +++ b/components/camel-tarfile/src/test/java/org/apache/camel/dataformat/tarfile/TarSplitterRouteIssueTest.java @@ -21,19 +21,20 @@ import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.test.junit5.CamelTestSupport; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import static org.apache.camel.test.junit5.TestSupport.deleteDirectory; -public class TarSplitterRouteIssueTest extends CamelTestSupport { +class TarSplitterRouteIssueTest extends CamelTestSupport { - @Override - public void doPreSetup() { + @BeforeEach + public void cleanOutputDirectory() { deleteDirectory("target/tar"); } @Test - public void testSplitter() throws Exception { + void testSplitter() throws Exception { getMockEndpoint("mock:entry").expectedMessageCount(3); template.sendBody("direct:decompressFiles", new File("src/test/resources/data/tarfile3.tar")); @@ -42,7 +43,7 @@ public void testSplitter() throws Exception { } @Test - public void testSplitterWithWrongFile() throws Exception { + void testSplitterWithWrongFile() throws Exception { getMockEndpoint("mock:entry").expectedMessageCount(0); getMockEndpoint("mock:errors").expectedMessageCount(1); diff --git a/components/camel-tarfile/src/test/java/org/apache/camel/processor/aggregate/tarfile/AggregationStrategyWithFilenameHeaderTest.java b/components/camel-tarfile/src/test/java/org/apache/camel/processor/aggregate/tarfile/AggregationStrategyWithFilenameHeaderTest.java index 9972385310c1b..45c4e1770d865 100644 --- a/components/camel-tarfile/src/test/java/org/apache/camel/processor/aggregate/tarfile/AggregationStrategyWithFilenameHeaderTest.java +++ b/components/camel-tarfile/src/test/java/org/apache/camel/processor/aggregate/tarfile/AggregationStrategyWithFilenameHeaderTest.java @@ -30,6 +30,7 @@ import org.apache.commons.compress.archivers.ArchiveStreamFactory; import org.apache.commons.compress.archivers.tar.TarArchiveEntry; import org.apache.commons.compress.archivers.tar.TarArchiveInputStream; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import static org.apache.camel.test.junit5.TestSupport.deleteDirectory; @@ -37,21 +38,21 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; -public class AggregationStrategyWithFilenameHeaderTest extends CamelTestSupport { +class AggregationStrategyWithFilenameHeaderTest extends CamelTestSupport { private static final List FILE_NAMES = Arrays.asList("foo", "bar"); private TarAggregationStrategy tar = new TarAggregationStrategy(false, true); - @Override - public void doPreSetup() { + @BeforeEach + public void cleanOutputDirectories() { tar.setParentDir("target/temp"); deleteDirectory("target/temp"); deleteDirectory("target/out"); } @Test - public void testSplitter() throws Exception { + void testSplitter() throws Exception { MockEndpoint mock = getMockEndpoint("mock:aggregateToTarEntry"); mock.expectedMessageCount(1); @@ -69,7 +70,7 @@ public void testSplitter() throws Exception { File resultFile = files[0]; final TarArchiveInputStream tis - = (TarArchiveInputStream) new ArchiveStreamFactory().createArchiveInputStream(ArchiveStreamFactory.TAR, + = new ArchiveStreamFactory().createArchiveInputStream(ArchiveStreamFactory.TAR, new BufferedInputStream(new FileInputStream(resultFile))); try { int fileCount = 0; diff --git a/components/camel-tarfile/src/test/java/org/apache/camel/processor/aggregate/tarfile/AggregationStrategyWithPreservationTest.java b/components/camel-tarfile/src/test/java/org/apache/camel/processor/aggregate/tarfile/AggregationStrategyWithPreservationTest.java index 7a9803c6e7a26..a014c5cbdefde 100644 --- a/components/camel-tarfile/src/test/java/org/apache/camel/processor/aggregate/tarfile/AggregationStrategyWithPreservationTest.java +++ b/components/camel-tarfile/src/test/java/org/apache/camel/processor/aggregate/tarfile/AggregationStrategyWithPreservationTest.java @@ -28,6 +28,7 @@ import org.apache.camel.util.IOHelper; import org.apache.commons.compress.archivers.tar.TarArchiveEntry; import org.apache.commons.compress.archivers.tar.TarArchiveInputStream; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import static org.apache.camel.test.junit5.TestSupport.deleteDirectory; @@ -35,21 +36,21 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.fail; -public class AggregationStrategyWithPreservationTest extends CamelTestSupport { +class AggregationStrategyWithPreservationTest extends CamelTestSupport { private static final int EXPECTED_NO_FILES = 5; private TarAggregationStrategy tar = new TarAggregationStrategy(true, true); - @Override - public void doPreSetup() { + @BeforeEach + public void cleanOutputDirectories() { tar.setParentDir("target/temp"); deleteDirectory("target/temp"); deleteDirectory("target/out"); } @Test - public void testSplitter() throws Exception { + void testSplitter() throws Exception { MockEndpoint mock = getMockEndpoint("mock:aggregateToTarEntry"); mock.expectedMessageCount(1); diff --git a/components/camel-tarfile/src/test/java/org/apache/camel/processor/aggregate/tarfile/TarAggregationStrategyEmptyFirstFileTest.java b/components/camel-tarfile/src/test/java/org/apache/camel/processor/aggregate/tarfile/TarAggregationStrategyEmptyFirstFileTest.java index dccf8acf0a58f..31e50d234a1f8 100644 --- a/components/camel-tarfile/src/test/java/org/apache/camel/processor/aggregate/tarfile/TarAggregationStrategyEmptyFirstFileTest.java +++ b/components/camel-tarfile/src/test/java/org/apache/camel/processor/aggregate/tarfile/TarAggregationStrategyEmptyFirstFileTest.java @@ -34,34 +34,35 @@ import org.apache.commons.compress.archivers.tar.TarArchiveEntry; import org.apache.commons.compress.archivers.tar.TarArchiveInputStream; import org.apache.logging.log4j.core.util.IOUtils; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; -public class TarAggregationStrategyEmptyFirstFileTest extends CamelTestSupport { +class TarAggregationStrategyEmptyFirstFileTest extends CamelTestSupport { - @Override - public void doPreSetup() { + @BeforeEach + public void cleanOutputDirectory() { TestSupport.deleteDirectory("target/out"); } @Test - public void testNormal() throws Exception { + void testNormal() throws Exception { doTest("A", "B", "C"); } @Test - public void testEmptyFirst() throws Exception { + void testEmptyFirst() throws Exception { doTest("", "A"); } @Test - public void testEmptyOnly() throws Exception { + void testEmptyOnly() throws Exception { doTest(""); } @Test - public void testEmptyMiddle() throws Exception { + void testEmptyMiddle() throws Exception { doTest("Start", "", "", "End"); } @@ -122,9 +123,9 @@ private static Map readTar(File file) throws IOException { Map content = new TreeMap<>(); TarArchiveInputStream tin = new TarArchiveInputStream(new FileInputStream(file)); try { - for (TarArchiveEntry te = (TarArchiveEntry) tin.getNextEntry(); + for (TarArchiveEntry te = tin.getNextEntry(); te != null; - te = (TarArchiveEntry) tin.getNextEntry()) { + te = tin.getNextEntry()) { String c = IOUtils.toString(new InputStreamReader(tin)); content.put(te.getName(), c); } diff --git a/components/camel-tarfile/src/test/java/org/apache/camel/processor/aggregate/tarfile/TarAggregationStrategyTest.java b/components/camel-tarfile/src/test/java/org/apache/camel/processor/aggregate/tarfile/TarAggregationStrategyTest.java index b532da1147498..91b3aba1ad9e2 100644 --- a/components/camel-tarfile/src/test/java/org/apache/camel/processor/aggregate/tarfile/TarAggregationStrategyTest.java +++ b/components/camel-tarfile/src/test/java/org/apache/camel/processor/aggregate/tarfile/TarAggregationStrategyTest.java @@ -25,27 +25,28 @@ import org.apache.camel.util.IOHelper; import org.apache.commons.compress.archivers.tar.TarArchiveEntry; import org.apache.commons.compress.archivers.tar.TarArchiveInputStream; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import static org.apache.camel.test.junit5.TestSupport.deleteDirectory; import static org.awaitility.Awaitility.await; import static org.junit.jupiter.api.Assertions.assertEquals; -public class TarAggregationStrategyTest extends CamelTestSupport { +class TarAggregationStrategyTest extends CamelTestSupport { private static final int EXPECTED_NO_FILES = 3; private TarAggregationStrategy tar = new TarAggregationStrategy(); - @Override - public void doPreSetup() { + @BeforeEach + public void cleanOutputDirectories() { tar.setParentDir("target/temp"); deleteDirectory("target/temp"); deleteDirectory("target/out"); } @Test - public void testSplitter() throws Exception { + void testSplitter() throws Exception { MockEndpoint mock = getMockEndpoint("mock:aggregateToTarEntry"); mock.expectedMessageCount(1); mock.expectedHeaderReceived("foo", "bar");