From 13be48cfe35f896d5c54e00f9b0d03c4f8ac950a Mon Sep 17 00:00:00 2001 From: Mike Thomsen Date: Wed, 25 Aug 2021 16:13:06 -0400 Subject: [PATCH] NIFI-9113 Refactored nifi-grpc-bundle to use JUnit 5 - NIFI-9111 Refactored nifi-gcp-bundle to use JUnit 5 - NIFI-9110 Refactored nifi-flume-bundle to use JUnit 5 - NIFI-9108 Refactored nifi-evtx-bundle to use JUnit 5 - NIFI-9106 Refactored nifi-email-bundle to use JUnit 5 - NIFI-9105 Refactored nifi-easyrules-bundle to use JUnit 5 - NIFI-9104 Refactored nifi-druid-bundle to use JUnit 5 This closes #5790 Signed-off-by: David Handermann --- .../druid/DruidTranquilityControllerTest.java | 6 +- .../processors/druid/PutDruidRecordTest.java | 10 +-- .../apache/nifi/rules/TestRulesCondition.java | 24 ++--- .../apache/nifi/rules/TestRulesFactory.java | 89 +++++++------------ .../rules/engine/TestEasyRulesEngine.java | 17 ++-- .../engine/TestEasyRulesEngineProvider.java | 6 +- .../engine/TestEasyRulesEngineService.java | 50 ++++------- .../processors/email/ITestConsumeEmail.java | 26 +++--- .../email/TestExtractEmailAttachments.java | 7 +- .../email/TestExtractEmailHeaders.java | 13 +-- .../email/TestExtractTNEFAttachments.java | 12 +-- .../nifi/processors/email/TestListenSMTP.java | 42 ++++----- .../nifi-evtx-processors/pom.xml | 6 ++ .../evtx/MalformedChunkHandlerTest.java | 12 +-- .../nifi/processors/evtx/ParseEvtxTest.java | 60 +++++++------ .../processors/evtx/ResultProcessorTest.java | 12 +-- .../evtx/XmlBxmlNodeVisitorTest.java | 12 +-- .../evtx/XmlRootNodeHandlerTest.java | 25 +++--- .../evtx/parser/BinaryReaderTest.java | 11 +-- .../evtx/parser/ChunkHeaderTest.java | 6 +- .../evtx/parser/FileHeaderTest.java | 6 +- .../processors/evtx/parser/RecordTest.java | 12 +-- .../evtx/parser/bxml/AttributeNodeTest.java | 4 +- .../evtx/parser/bxml/BxmlNodeTestBase.java | 10 +-- .../parser/bxml/CDataSectionNodeTest.java | 4 +- .../parser/bxml/CloseElementNodeTest.java | 4 +- .../bxml/CloseEmptyElementNodeTest.java | 4 +- .../bxml/CloseStartElementNodeTest.java | 4 +- .../bxml/ConditionalSubstitutionNodeTest.java | 4 +- .../evtx/parser/bxml/EndOfStreamNodeTest.java | 4 +- .../parser/bxml/EntityReferenceNodeTest.java | 4 +- .../evtx/parser/bxml/NameStringNodeTest.java | 4 +- .../bxml/NormalSubstitutionNodeTest.java | 4 +- .../parser/bxml/OpenStartElementNodeTest.java | 4 +- .../ProcessingInstructionDataNodeTest.java | 4 +- .../ProcessingInstructionTargetNodeTest.java | 4 +- .../evtx/parser/bxml/RootNodeTest.java | 4 +- .../evtx/parser/bxml/StreamStartNodeTest.java | 4 +- .../parser/bxml/TemplateInstanceNodeTest.java | 4 +- .../evtx/parser/bxml/TemplateNodeTest.java | 4 +- .../evtx/parser/bxml/ValueNodeTest.java | 4 +- .../parser/bxml/value/BXmlTypeNodeTest.java | 8 +- .../parser/bxml/value/BinaryTypeNodeTest.java | 7 +- .../bxml/value/BooleanTypeNodeTest.java | 6 +- .../parser/bxml/value/DoubleTypeNodeTest.java | 4 +- .../bxml/value/FiletimeTypeNodeTest.java | 4 +- .../parser/bxml/value/FloatTypeNodeTest.java | 4 +- .../parser/bxml/value/GuidTypeNodeTest.java | 4 +- .../parser/bxml/value/Hex32TypeNodeTest.java | 2 +- .../parser/bxml/value/Hex64TypeNodeTest.java | 2 +- .../parser/bxml/value/NullTypeNodeTest.java | 2 +- .../parser/bxml/value/SIDTypeNodeTest.java | 2 +- .../bxml/value/SignedByteTypeNodeTest.java | 2 +- .../bxml/value/SignedDWordTypeNodeTest.java | 2 +- .../bxml/value/SignedQWordTypeNodeTest.java | 2 +- .../bxml/value/SignedWordTypeNodeTest.java | 2 +- .../parser/bxml/value/SizeTypeNodeTest.java | 2 +- .../parser/bxml/value/StringTypeNodeTest.java | 2 +- .../bxml/value/SystemtimeTypeNodeTest.java | 2 +- .../bxml/value/UnsignedByteTypeNodeTest.java | 2 +- .../bxml/value/UnsignedDWordTypeNodeTest.java | 2 +- .../bxml/value/UnsignedQWordTypeNodeTest.java | 2 +- .../bxml/value/UnsignedWordTypeNodeTest.java | 2 +- .../bxml/value/WStringArrayTypeNodeTest.java | 2 +- .../bxml/value/WStringTypeNodeTest.java | 2 +- .../flume/ExecuteFlumeSinkTest.java | 62 +++++++------ .../flume/ExecuteFlumeSourceTest.java | 54 +++++------ .../nifi-gcp-processors/pom.xml | 2 - .../gcp/bigquery/AbstractBQTest.java | 6 +- .../gcp/bigquery/AbstractBigQueryIT.java | 40 ++++----- .../gcp/bigquery/PutBigQueryBatchIT.java | 19 ++-- .../gcp/bigquery/PutBigQueryBatchTest.java | 6 +- .../gcp/bigquery/PutBigQueryStreamingIT.java | 41 +++++---- .../factory/CredentialsFactoryTest.java | 2 +- .../service/GCPCredentialsServiceTest.java | 4 +- .../gcp/pubsub/ConsumeGCPubSubIT.java | 6 +- .../gcp/pubsub/PublishGCPubSubIT.java | 6 +- .../processors/gcp/storage/AbstractGCSIT.java | 11 +-- .../gcp/storage/AbstractGCSTest.java | 8 ++ .../gcp/storage/DeleteGCSObjectIT.java | 2 +- .../gcp/storage/DeleteGCSObjectTest.java | 8 ++ .../gcp/storage/FetchGCSObjectIT.java | 2 +- .../gcp/storage/FetchGCSObjectTest.java | 8 ++ .../gcp/storage/ListGCSBucketIT.java | 2 +- .../gcp/storage/PutGCSObjectIT.java | 2 +- .../gcp/storage/PutGCSObjectTest.java | 39 ++++---- .../gcp/storage/StorageAttributesTest.java | 2 +- .../nifi/processors/gcp/storage/UtilTest.java | 2 +- .../nifi/processors/grpc/ITListenGRPC.java | 83 ++++++++--------- .../nifi/processors/grpc/TestInvokeGRPC.java | 5 +- 90 files changed, 525 insertions(+), 514 deletions(-) diff --git a/nifi-nar-bundles/nifi-druid-bundle/nifi-druid-controller-service/src/test/java/org/apache/nifi/controller/druid/DruidTranquilityControllerTest.java b/nifi-nar-bundles/nifi-druid-bundle/nifi-druid-controller-service/src/test/java/org/apache/nifi/controller/druid/DruidTranquilityControllerTest.java index acccb67d35..67f8adab73 100644 --- a/nifi-nar-bundles/nifi-druid-bundle/nifi-druid-controller-service/src/test/java/org/apache/nifi/controller/druid/DruidTranquilityControllerTest.java +++ b/nifi-nar-bundles/nifi-druid-bundle/nifi-druid-controller-service/src/test/java/org/apache/nifi/controller/druid/DruidTranquilityControllerTest.java @@ -27,8 +27,8 @@ import org.apache.nifi.processor.ProcessSession; import org.apache.nifi.processor.exception.ProcessException; import org.apache.nifi.util.TestRunner; import org.apache.nifi.util.TestRunners; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.util.ArrayList; import java.util.List; @@ -40,7 +40,7 @@ public class DruidTranquilityControllerTest { private TestRunner runner; private MockDruidTranquilityController service; - @Before + @BeforeEach public void setup() throws Exception { runner = TestRunners.newTestRunner(TestControllerServiceProcessor.class); service = new MockDruidTranquilityController(); diff --git a/nifi-nar-bundles/nifi-druid-bundle/nifi-druid-processors/src/test/java/org/apache/nifi/processors/druid/PutDruidRecordTest.java b/nifi-nar-bundles/nifi-druid-bundle/nifi-druid-processors/src/test/java/org/apache/nifi/processors/druid/PutDruidRecordTest.java index 28e084c4ef..5f93ac63a6 100644 --- a/nifi-nar-bundles/nifi-druid-bundle/nifi-druid-processors/src/test/java/org/apache/nifi/processors/druid/PutDruidRecordTest.java +++ b/nifi-nar-bundles/nifi-druid-bundle/nifi-druid-processors/src/test/java/org/apache/nifi/processors/druid/PutDruidRecordTest.java @@ -17,9 +17,9 @@ package org.apache.nifi.processors.druid; +import org.apache.nifi.controller.api.druid.DruidTranquilityService; import org.apache.nifi.controller.druid.DruidTranquilityController; import org.apache.nifi.controller.druid.MockDruidTranquilityController; -import org.apache.nifi.controller.api.druid.DruidTranquilityService; import org.apache.nifi.provenance.ProvenanceEventType; import org.apache.nifi.serialization.record.MockRecordParser; import org.apache.nifi.serialization.record.MockRecordWriter; @@ -27,10 +27,10 @@ import org.apache.nifi.serialization.record.RecordFieldType; import org.apache.nifi.util.MockFlowFile; import org.apache.nifi.util.TestRunner; import org.apache.nifi.util.TestRunners; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; public class PutDruidRecordTest { @@ -40,7 +40,7 @@ public class PutDruidRecordTest { private MockRecordParser recordReader; private MockRecordWriter recordWriter; - @Before + @BeforeEach public void setUp() throws Exception { runner = TestRunners.newTestRunner(PutDruidRecord.class); druidTranquilityController = new MockDruidTranquilityController(2,3); diff --git a/nifi-nar-bundles/nifi-easyrules-bundle/nifi-easyrules-service/src/test/java/org/apache/nifi/rules/TestRulesCondition.java b/nifi-nar-bundles/nifi-easyrules-bundle/nifi-easyrules-service/src/test/java/org/apache/nifi/rules/TestRulesCondition.java index d988a9a635..5bb452d51f 100644 --- a/nifi-nar-bundles/nifi-easyrules-bundle/nifi-easyrules-service/src/test/java/org/apache/nifi/rules/TestRulesCondition.java +++ b/nifi-nar-bundles/nifi-easyrules-bundle/nifi-easyrules-service/src/test/java/org/apache/nifi/rules/TestRulesCondition.java @@ -18,11 +18,11 @@ package org.apache.nifi.rules; import org.jeasy.rules.api.Condition; import org.jeasy.rules.api.Facts; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; public class TestRulesCondition { @@ -54,11 +54,7 @@ public class TestRulesCondition { Facts facts = new Facts(); facts.put("predictedQueued",100); Condition condition = new RulesMVELCondition(expression, false); - try { - condition.evaluate(facts); - fail(); - }catch (Exception ignored){ - } + assertThrows(Exception.class, () -> condition.evaluate(facts)); } @Test @@ -89,12 +85,6 @@ public class TestRulesCondition { Facts facts = new Facts(); facts.put("predictedQueuedCount",100); Condition condition = new RulesSPELCondition(expression, false); - try { - condition.evaluate(facts); - fail(); - }catch (Exception ignored){ - } + assertThrows(Exception.class, () -> condition.evaluate(facts)); } - - -} +} \ No newline at end of file diff --git a/nifi-nar-bundles/nifi-easyrules-bundle/nifi-easyrules-service/src/test/java/org/apache/nifi/rules/TestRulesFactory.java b/nifi-nar-bundles/nifi-easyrules-bundle/nifi-easyrules-service/src/test/java/org/apache/nifi/rules/TestRulesFactory.java index a08b805380..9f4491e8d5 100644 --- a/nifi-nar-bundles/nifi-easyrules-bundle/nifi-easyrules-service/src/test/java/org/apache/nifi/rules/TestRulesFactory.java +++ b/nifi-nar-bundles/nifi-easyrules-bundle/nifi-easyrules-service/src/test/java/org/apache/nifi/rules/TestRulesFactory.java @@ -16,92 +16,81 @@ */ package org.apache.nifi.rules; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.List; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertThrows; public class TestRulesFactory { @Test public void testCreateRulesFromNiFiYaml(){ - try { + assertDoesNotThrow(() -> { String testYamlFile = "src/test/resources/test_nifi_rules.yml"; - List rules = RulesFactory.createRulesFromFile(testYamlFile,"YAML", "NIFI"); + List rules = RulesFactory.createRulesFromFile(testYamlFile, "YAML", "NIFI"); assertEquals(2, rules.size()); assert confirmEntries(rules); - }catch (Exception ex){ - fail("Unexpected exception occurred: "+ex.getMessage()); - } + }); } @Test public void testCreateRulesFromMvelYaml(){ - try { + assertDoesNotThrow(() -> { String testYamlFile = "src/test/resources/test_mvel_rules.yml"; - List rules = RulesFactory.createRulesFromFile(testYamlFile,"YAML", "MVEL"); + List rules = RulesFactory.createRulesFromFile(testYamlFile, "YAML", "MVEL"); assertEquals(2, rules.size()); assert confirmEntries(rules); assertSame("EXPRESSION", rules.get(0).getActions().get(0).getType()); - }catch (Exception ex){ - fail("Unexpected exception occurred: "+ex.getMessage()); - } + }); } @Test public void testCreateRulesFromSpelYaml(){ - try { + assertDoesNotThrow(() -> { String testYamlFile = "src/test/resources/test_spel_rules.yml"; - List rules = RulesFactory.createRulesFromFile(testYamlFile,"YAML", "SPEL"); + List rules = RulesFactory.createRulesFromFile(testYamlFile, "YAML", "SPEL"); assertEquals(2, rules.size()); assertSame("EXPRESSION", rules.get(0).getActions().get(0).getType()); - }catch (Exception ex){ - fail("Unexpected exception occurred: "+ex.getMessage()); - } + }); } @Test public void testCreateRulesFromNiFiJson(){ - try { + assertDoesNotThrow(() -> { String testJsonFile = "src/test/resources/test_nifi_rules.json"; - List rules = RulesFactory.createRulesFromFile(testJsonFile,"JSON", "NIFI"); + List rules = RulesFactory.createRulesFromFile(testJsonFile, "JSON", "NIFI"); assertEquals(2, rules.size()); assert confirmEntries(rules); - }catch (Exception ex){ - fail("Unexpected exception occurred: "+ex.getMessage()); - } + }); } @Test public void testCreateRulesFromMvelJson(){ - try { + assertDoesNotThrow(() -> { String testJsonFile = "src/test/resources/test_mvel_rules.json"; - List rules = RulesFactory.createRulesFromFile(testJsonFile,"JSON", "MVEL"); + List rules = RulesFactory.createRulesFromFile(testJsonFile, "JSON", "MVEL"); assertEquals(2, rules.size()); assertSame("EXPRESSION", rules.get(0).getActions().get(0).getType()); assert confirmEntries(rules); - }catch (Exception ex){ - fail("Unexpected exception occurred: "+ex.getMessage()); - } + }); } @Test public void testCreateRulesFromSpelJson(){ - try { + assertDoesNotThrow(() -> { String testJsonFile = "src/test/resources/test_spel_rules.json"; - List rules = RulesFactory.createRulesFromFile(testJsonFile,"JSON", "SPEL"); + List rules = RulesFactory.createRulesFromFile(testJsonFile, "JSON", "SPEL"); assertEquals(2, rules.size()); assertSame("EXPRESSION", rules.get(0).getActions().get(0).getType()); - }catch (Exception ex){ - fail("Unexpected exception occurred: "+ex.getMessage()); - } + }); } @Test public void testCreateRulesFromStringSpelJson(){ - try { + assertDoesNotThrow(() -> { String testJson = "[\n" + " {\n" + " \"name\": \"Queue Size\",\n" + @@ -118,17 +107,15 @@ public class TestRulesFactory { " \"actions\": [\"'System is approaching backpressure! Predicted time left: ' + #predictedTimeToBytesBackpressureMillis\"]\n" + " }\n" + "]"; - List rules = RulesFactory.createRulesFromString(testJson,"JSON", "SPEL"); + List rules = RulesFactory.createRulesFromString(testJson, "JSON", "SPEL"); assertEquals(2, rules.size()); assertSame("EXPRESSION", rules.get(0).getActions().get(0).getType()); - }catch (Exception ex){ - fail("Unexpected exception occurred: "+ex.getMessage()); - } + }); } @Test public void testCreateRulesFromStringSpelYaml(){ - try { + assertDoesNotThrow(() -> { String testYaml = "---\n" + "name: \"Queue Size\"\n" + "description: \"Queue size check greater than 50\"\n" + @@ -143,32 +130,22 @@ public class TestRulesFactory { "condition: \"#predictedTimeToBytesBackpressureMillis < 300000 && #predictedTimeToBytesBackpressureMillis >= 0\"\n" + "actions:\n" + " - \"System.out.println(\\\"Back Pressure prediction less than 5 minutes!\\\")\""; - List rules = RulesFactory.createRulesFromString(testYaml,"YAML", "SPEL"); + List rules = RulesFactory.createRulesFromString(testYaml, "YAML", "SPEL"); assertEquals(2, rules.size()); assertSame("EXPRESSION", rules.get(0).getActions().get(0).getType()); - }catch (Exception ex){ - fail("Unexpected exception occurred: "+ex.getMessage()); - } + }); } @Test public void testFakeTypeNotSupported(){ - try { - RulesFactory.createRulesFromFile("FAKEFILE", "FAKE", "NIFI"); - }catch (Exception ex){ - return; - } - fail("Exception should have been thrown for unexpected type"); + assertThrows(Exception.class, + () -> RulesFactory.createRulesFromFile("FAKEFILE", "FAKE", "NIFI")); } @Test public void testFakeFormatNotSupported(){ - try { - RulesFactory.createRulesFromFile("FAKEFILE", "JSON", "FAKE"); - }catch (Exception ex){ - return; - } - fail("Exception should have been thrown for unexpected type"); + assertThrows(Exception.class, + () -> RulesFactory.createRulesFromFile("FAKEFILE", "JSON", "FAKE")); } diff --git a/nifi-nar-bundles/nifi-easyrules-bundle/nifi-easyrules-service/src/test/java/org/apache/nifi/rules/engine/TestEasyRulesEngine.java b/nifi-nar-bundles/nifi-easyrules-bundle/nifi-easyrules-service/src/test/java/org/apache/nifi/rules/engine/TestEasyRulesEngine.java index 092f63d300..b543d7e184 100644 --- a/nifi-nar-bundles/nifi-easyrules-bundle/nifi-easyrules-service/src/test/java/org/apache/nifi/rules/engine/TestEasyRulesEngine.java +++ b/nifi-nar-bundles/nifi-easyrules-bundle/nifi-easyrules-service/src/test/java/org/apache/nifi/rules/engine/TestEasyRulesEngine.java @@ -15,19 +15,19 @@ * limitations under the License. */ package org.apache.nifi.rules.engine; + import org.apache.nifi.rules.Action; import org.apache.nifi.rules.Rule; import org.apache.nifi.rules.RulesFactory; -import org.junit.Test; - +import org.junit.jupiter.api.Test; import java.util.HashMap; import java.util.List; import java.util.Map; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertThrows; public class TestEasyRulesEngine { @@ -65,12 +65,7 @@ public class TestEasyRulesEngine { Map facts = new HashMap<>(); facts.put("predictedQueuedCount",60); facts.put("predictedTimeToBytesBackpressure",311111); - try { - service.fireRules(facts); - fail("Error condition exception was not thrown"); - }catch (Exception ignored){ - } - + assertThrows(Exception.class, () -> service.fireRules(facts)); } @Test diff --git a/nifi-nar-bundles/nifi-easyrules-bundle/nifi-easyrules-service/src/test/java/org/apache/nifi/rules/engine/TestEasyRulesEngineProvider.java b/nifi-nar-bundles/nifi-easyrules-bundle/nifi-easyrules-service/src/test/java/org/apache/nifi/rules/engine/TestEasyRulesEngineProvider.java index 538bb76df6..86cb55127a 100644 --- a/nifi-nar-bundles/nifi-easyrules-bundle/nifi-easyrules-service/src/test/java/org/apache/nifi/rules/engine/TestEasyRulesEngineProvider.java +++ b/nifi-nar-bundles/nifi-easyrules-bundle/nifi-easyrules-service/src/test/java/org/apache/nifi/rules/engine/TestEasyRulesEngineProvider.java @@ -20,15 +20,15 @@ import org.apache.nifi.reporting.InitializationException; import org.apache.nifi.rules.Action; import org.apache.nifi.util.TestRunner; import org.apache.nifi.util.TestRunners; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.IOException; import java.util.HashMap; import java.util.List; import java.util.Map; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; public class TestEasyRulesEngineProvider { diff --git a/nifi-nar-bundles/nifi-easyrules-bundle/nifi-easyrules-service/src/test/java/org/apache/nifi/rules/engine/TestEasyRulesEngineService.java b/nifi-nar-bundles/nifi-easyrules-bundle/nifi-easyrules-service/src/test/java/org/apache/nifi/rules/engine/TestEasyRulesEngineService.java index 5513212fcb..75ec502189 100644 --- a/nifi-nar-bundles/nifi-easyrules-bundle/nifi-easyrules-service/src/test/java/org/apache/nifi/rules/engine/TestEasyRulesEngineService.java +++ b/nifi-nar-bundles/nifi-easyrules-bundle/nifi-easyrules-service/src/test/java/org/apache/nifi/rules/engine/TestEasyRulesEngineService.java @@ -20,17 +20,17 @@ import org.apache.nifi.reporting.InitializationException; import org.apache.nifi.rules.Action; import org.apache.nifi.util.TestRunner; import org.apache.nifi.util.TestRunners; -import org.junit.Test; -import org.mvel2.PropertyAccessException; +import org.junit.jupiter.api.Test; import java.io.IOException; import java.util.HashMap; import java.util.List; import java.util.Map; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertThrows; public class TestEasyRulesEngineService { @@ -225,12 +225,7 @@ public class TestEasyRulesEngineService { Map facts = new HashMap<>(); facts.put("fakeMetric",60); facts.put("predictedTimeToBytesBackpressureMillis",299999); - try { - service.fireRules(facts); - fail("Expected exception to be thrown"); - }catch (Exception pae){ - assert true; - } + assertThrows(Exception.class, () -> service.fireRules(facts)); } @Test @@ -247,13 +242,11 @@ public class TestEasyRulesEngineService { Map facts = new HashMap<>(); facts.put("fakeMetric",60); facts.put("predictedTimeToBytesBackpressureMillis",299999); - try { + assertDoesNotThrow(() -> { List actions = service.fireRules(facts); assertNotNull(actions); assertEquals(actions.size(), 1); - }catch (PropertyAccessException pae){ - fail(); - } + }); } @Test @@ -270,12 +263,7 @@ public class TestEasyRulesEngineService { Map facts = new HashMap<>(); facts.put("fakeMetric",60); facts.put("predictedTimeToBytesBackpressureMillis",299999); - try { - service.fireRules(facts); - fail("Expected exception to be thrown"); - }catch (Exception pae){ - assert true; - } + assertThrows(Exception.class, () -> service.fireRules(facts)); } @Test @@ -292,13 +280,11 @@ public class TestEasyRulesEngineService { Map facts = new HashMap<>(); facts.put("fakeMetric",60); facts.put("predictedTimeToBytesBackpressureMillis",299999); - try { + assertDoesNotThrow(() -> { List actions = service.fireRules(facts); assertNotNull(actions); assertEquals(actions.size(), 1); - }catch (PropertyAccessException pae){ - fail(); - } + }); } @Test @@ -315,12 +301,7 @@ public class TestEasyRulesEngineService { Map facts = new HashMap<>(); facts.put("fakeMetric",60); facts.put("fakeMetric2",299999); - try { - service.fireRules(facts); - fail("Expected exception to be thrown"); - }catch (Exception pae){ - assert true; - } + assertThrows(Exception.class, () -> service.fireRules(facts)); } @Test @@ -337,13 +318,12 @@ public class TestEasyRulesEngineService { Map facts = new HashMap<>(); facts.put("predictedQueuedCount",60); facts.put("predictedTimeToBytesBackpressureMillis",299999); - try { + + assertDoesNotThrow(() -> { List actions = service.fireRules(facts); assertNotNull(actions); assertEquals(actions.size(), 1); - }catch (Exception pae){ - fail(); - } + }); } @Test diff --git a/nifi-nar-bundles/nifi-email-bundle/nifi-email-processors/src/test/java/org/apache/nifi/processors/email/ITestConsumeEmail.java b/nifi-nar-bundles/nifi-email-bundle/nifi-email-processors/src/test/java/org/apache/nifi/processors/email/ITestConsumeEmail.java index bcc394690b..75c6c39098 100644 --- a/nifi-nar-bundles/nifi-email-bundle/nifi-email-processors/src/test/java/org/apache/nifi/processors/email/ITestConsumeEmail.java +++ b/nifi-nar-bundles/nifi-email-bundle/nifi-email-processors/src/test/java/org/apache/nifi/processors/email/ITestConsumeEmail.java @@ -23,10 +23,9 @@ import com.icegreen.greenmail.util.ServerSetupTest; import org.apache.nifi.util.MockFlowFile; import org.apache.nifi.util.TestRunner; import org.apache.nifi.util.TestRunners; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.Assert; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.integration.mail.AbstractMailReceiver; import javax.mail.Message; @@ -38,7 +37,8 @@ import java.lang.reflect.Field; import java.util.List; import java.util.Properties; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; public class ITestConsumeEmail { @@ -49,7 +49,7 @@ public class ITestConsumeEmail { private GreenMailUser popUser; // Setup mock imap server - @Before + @BeforeEach public void setUp() { mockIMAP4Server = new GreenMail(ServerSetupTest.IMAP); mockIMAP4Server.start(); @@ -60,7 +60,7 @@ public class ITestConsumeEmail { popUser = mockPOP3Server.setUser("test@nifi.org", "nifiUserPop", "nifiPassword"); } - @After + @AfterEach public void cleanUp() { mockIMAP4Server.stop(); mockPOP3Server.stop(); @@ -99,13 +99,13 @@ public class ITestConsumeEmail { String result = new String(runner.getContentAsByteArray(messages.get(0))); // Verify body - Assert.assertTrue(result.contains("test test test chocolate")); + assertTrue(result.contains("test test test chocolate")); // Verify sender - Assert.assertTrue(result.contains("alice@nifi.org")); + assertTrue(result.contains("alice@nifi.org")); // Verify subject - Assert.assertTrue(result.contains("testConsumeImap1")); + assertTrue(result.contains("testConsumeImap1")); } @@ -130,13 +130,13 @@ public class ITestConsumeEmail { String result = new String(runner.getContentAsByteArray(messages.get(0))); // Verify body - Assert.assertTrue(result.contains("test test test chocolate")); + assertTrue(result.contains("test test test chocolate")); // Verify sender - Assert.assertTrue(result.contains("alice@nifi.org")); + assertTrue(result.contains("alice@nifi.org")); // Verify subject - Assert.assertTrue(result.contains("Pop1")); + assertTrue(result.contains("Pop1")); } diff --git a/nifi-nar-bundles/nifi-email-bundle/nifi-email-processors/src/test/java/org/apache/nifi/processors/email/TestExtractEmailAttachments.java b/nifi-nar-bundles/nifi-email-bundle/nifi-email-processors/src/test/java/org/apache/nifi/processors/email/TestExtractEmailAttachments.java index ee629a6c9d..ecaf548ae3 100644 --- a/nifi-nar-bundles/nifi-email-bundle/nifi-email-processors/src/test/java/org/apache/nifi/processors/email/TestExtractEmailAttachments.java +++ b/nifi-nar-bundles/nifi-email-bundle/nifi-email-processors/src/test/java/org/apache/nifi/processors/email/TestExtractEmailAttachments.java @@ -20,14 +20,15 @@ package org.apache.nifi.processors.email; import org.apache.nifi.util.MockFlowFile; import org.apache.nifi.util.TestRunner; import org.apache.nifi.util.TestRunners; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Random; +import static org.junit.jupiter.api.Assertions.assertTrue; + public class TestExtractEmailAttachments { // Setups the fields to be used... @@ -81,7 +82,7 @@ public class TestExtractEmailAttachments { filenames.add(splits.get(a).getAttribute("filename").toString()); } - Assert.assertTrue(filenames.containsAll(Arrays.asList("pom.xml1", "pom.xml" + amount))); + assertTrue(filenames.containsAll(Arrays.asList("pom.xml1", "pom.xml" + amount))); } @Test diff --git a/nifi-nar-bundles/nifi-email-bundle/nifi-email-processors/src/test/java/org/apache/nifi/processors/email/TestExtractEmailHeaders.java b/nifi-nar-bundles/nifi-email-bundle/nifi-email-processors/src/test/java/org/apache/nifi/processors/email/TestExtractEmailHeaders.java index f1652f4094..774e714b59 100644 --- a/nifi-nar-bundles/nifi-email-bundle/nifi-email-processors/src/test/java/org/apache/nifi/processors/email/TestExtractEmailHeaders.java +++ b/nifi-nar-bundles/nifi-email-bundle/nifi-email-processors/src/test/java/org/apache/nifi/processors/email/TestExtractEmailHeaders.java @@ -17,15 +17,16 @@ package org.apache.nifi.processors.email; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.util.List; -import javax.mail.MessagingException; -import javax.mail.internet.MimeMessage; import org.apache.nifi.util.MockFlowFile; import org.apache.nifi.util.TestRunner; import org.apache.nifi.util.TestRunners; -import org.junit.Test; +import org.junit.jupiter.api.Test; + +import javax.mail.MessagingException; +import javax.mail.internet.MimeMessage; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.List; public class TestExtractEmailHeaders { diff --git a/nifi-nar-bundles/nifi-email-bundle/nifi-email-processors/src/test/java/org/apache/nifi/processors/email/TestExtractTNEFAttachments.java b/nifi-nar-bundles/nifi-email-bundle/nifi-email-processors/src/test/java/org/apache/nifi/processors/email/TestExtractTNEFAttachments.java index 6438d98267..5683fd3941 100644 --- a/nifi-nar-bundles/nifi-email-bundle/nifi-email-processors/src/test/java/org/apache/nifi/processors/email/TestExtractTNEFAttachments.java +++ b/nifi-nar-bundles/nifi-email-bundle/nifi-email-processors/src/test/java/org/apache/nifi/processors/email/TestExtractTNEFAttachments.java @@ -20,14 +20,16 @@ package org.apache.nifi.processors.email; import org.apache.nifi.util.MockFlowFile; import org.apache.nifi.util.TestRunner; import org.apache.nifi.util.TestRunners; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + public class TestExtractTNEFAttachments { @Test @@ -42,7 +44,7 @@ public class TestExtractTNEFAttachments { runner.assertTransferCount(ExtractEmailAttachments.REL_ATTACHMENTS, 0); // Have a look at the attachments... final List splits = runner.getFlowFilesForRelationship(ExtractEmailAttachments.REL_ATTACHMENTS); - Assert.assertEquals(0, splits.size()); + assertEquals(0, splits.size()); } @Test @@ -63,7 +65,7 @@ public class TestExtractTNEFAttachments { filenames.add(flowFile.getAttribute("filename")); } - Assert.assertTrue(filenames.containsAll(Arrays.asList("nifiDrop.svg", "MINIFI~1.PNG"))); + assertTrue(filenames.containsAll(Arrays.asList("nifiDrop.svg", "MINIFI~1.PNG"))); } @Test @@ -84,7 +86,7 @@ public class TestExtractTNEFAttachments { filenames.add(flowFile.getAttribute("filename")); } - Assert.assertTrue(filenames.contains("nifiDrop.svg")); + assertTrue(filenames.contains("nifiDrop.svg")); } @Test diff --git a/nifi-nar-bundles/nifi-email-bundle/nifi-email-processors/src/test/java/org/apache/nifi/processors/email/TestListenSMTP.java b/nifi-nar-bundles/nifi-email-bundle/nifi-email-processors/src/test/java/org/apache/nifi/processors/email/TestListenSMTP.java index 63b1cf4252..34eb144394 100644 --- a/nifi-nar-bundles/nifi-email-bundle/nifi-email-processors/src/test/java/org/apache/nifi/processors/email/TestListenSMTP.java +++ b/nifi-nar-bundles/nifi-email-bundle/nifi-email-processors/src/test/java/org/apache/nifi/processors/email/TestListenSMTP.java @@ -16,22 +16,6 @@ */ package org.apache.nifi.processors.email; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThrows; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.security.GeneralSecurityException; -import java.util.Properties; -import javax.mail.Message; -import javax.mail.MessagingException; -import javax.mail.Session; -import javax.mail.Transport; -import javax.mail.internet.InternetAddress; -import javax.mail.internet.MimeMessage; -import javax.net.ssl.SSLContext; - import org.apache.nifi.remote.io.socket.NetworkUtils; import org.apache.nifi.reporting.InitializationException; import org.apache.nifi.security.util.ClientAuth; @@ -43,8 +27,24 @@ import org.apache.nifi.ssl.RestrictedSSLContextService; import org.apache.nifi.ssl.SSLContextService; import org.apache.nifi.util.TestRunner; import org.apache.nifi.util.TestRunners; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +import javax.mail.Message; +import javax.mail.MessagingException; +import javax.mail.Session; +import javax.mail.Transport; +import javax.mail.internet.InternetAddress; +import javax.mail.internet.MimeMessage; +import javax.net.ssl.SSLContext; +import java.security.GeneralSecurityException; +import java.util.Properties; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; public class TestListenSMTP { private static final String SSL_SERVICE_IDENTIFIER = "ssl-context"; @@ -55,7 +55,7 @@ public class TestListenSMTP { private static final int MESSAGES = 2; - @BeforeClass + @BeforeAll public static void setTlsConfiguration() throws GeneralSecurityException { final TlsConfiguration testTlsConfiguration = new TemporaryKeyStoreBuilder().build(); @@ -80,7 +80,7 @@ public class TestListenSMTP { } @Test - public void testListenSMTP() throws Exception { + public void testListenSMTP() throws MessagingException { final int port = NetworkUtils.availablePort(); final TestRunner runner = newTestRunner(port); @@ -165,7 +165,7 @@ public class TestListenSMTP { } private void assertPortListening(final int port) { - assertTrue(String.format("expected server listening on %s:%d", "localhost", port), NetworkUtils.isListening("localhost", port, 5000)); + assertTrue(NetworkUtils.isListening("localhost", port, 5000), String.format("expected server listening on %s:%d", "localhost", port)); } private Session getSession(final int port) { diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/pom.xml b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/pom.xml index 0b3dfc3ee3..8a83a91f0f 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/pom.xml +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/pom.xml @@ -58,5 +58,11 @@ 1.16.0-SNAPSHOT test + + org.mockito + mockito-junit-jupiter + 3.9.0 + test + diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/MalformedChunkHandlerTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/MalformedChunkHandlerTest.java index c360676744..8a5f061844 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/MalformedChunkHandlerTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/MalformedChunkHandlerTest.java @@ -23,10 +23,10 @@ import org.apache.nifi.flowfile.attributes.CoreAttributes; import org.apache.nifi.processor.ProcessSession; import org.apache.nifi.processor.Relationship; import org.apache.nifi.processor.io.OutputStreamCallback; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.junit.MockitoJUnitRunner; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; import java.io.ByteArrayOutputStream; @@ -37,13 +37,13 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class MalformedChunkHandlerTest { Relationship badChunkRelationship; MalformedChunkHandler malformedChunkHandler; - @Before + @BeforeEach public void setup() { badChunkRelationship = new Relationship.Builder().build(); malformedChunkHandler = new MalformedChunkHandler(badChunkRelationship); diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/ParseEvtxTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/ParseEvtxTest.java index 5bdd9def84..6e1fd99d35 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/ParseEvtxTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/ParseEvtxTest.java @@ -17,28 +17,6 @@ package org.apache.nifi.processors.evtx; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.when; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.atomic.AtomicReference; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.stream.XMLStreamException; import org.apache.nifi.flowfile.FlowFile; import org.apache.nifi.flowfile.attributes.CoreAttributes; import org.apache.nifi.logging.ComponentLog; @@ -54,18 +32,44 @@ import org.apache.nifi.security.xml.XmlUtils; import org.apache.nifi.util.MockFlowFile; import org.apache.nifi.util.TestRunner; import org.apache.nifi.util.TestRunners; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; +import org.mockito.junit.jupiter.MockitoSettings; +import org.mockito.quality.Strictness; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; -@RunWith(MockitoJUnitRunner.class) +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.stream.XMLStreamException; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.atomic.AtomicReference; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.when; + +@ExtendWith(MockitoExtension.class) +@MockitoSettings(strictness = Strictness.LENIENT) public class ParseEvtxTest { public static final String USER_DATA = "UserData"; public static final String EVENT_DATA = "EventData"; @@ -98,7 +102,7 @@ public class ParseEvtxTest { ParseEvtx parseEvtx; - @Before + @BeforeEach public void setup() throws XMLStreamException, IOException { parseEvtx = new ParseEvtx(fileHeaderFactory, malformedChunkHandler, rootNodeHandlerFactory, resultProcessor); when(fileHeaderFactory.create(in, componentLog)).thenReturn(fileHeader); diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/ResultProcessorTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/ResultProcessorTest.java index abf64a68c6..b8f282e537 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/ResultProcessorTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/ResultProcessorTest.java @@ -23,10 +23,10 @@ import org.apache.nifi.flowfile.attributes.CoreAttributes; import org.apache.nifi.logging.ComponentLog; import org.apache.nifi.processor.ProcessSession; import org.apache.nifi.processor.Relationship; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.junit.MockitoJUnitRunner; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; @@ -36,14 +36,14 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class ResultProcessorTest { Relationship successRelationship; Relationship failureRelationship; ResultProcessor resultProcessor; - @Before + @BeforeEach public void setup() { successRelationship = new Relationship.Builder().build(); failureRelationship = new Relationship.Builder().build(); diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/XmlBxmlNodeVisitorTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/XmlBxmlNodeVisitorTest.java index b7693f5c1f..23c8fe6bcc 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/XmlBxmlNodeVisitorTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/XmlBxmlNodeVisitorTest.java @@ -31,13 +31,13 @@ import org.apache.nifi.processors.evtx.parser.bxml.TemplateNode; import org.apache.nifi.processors.evtx.parser.bxml.ValueNode; import org.apache.nifi.processors.evtx.parser.bxml.value.BXmlTypeNode; import org.apache.nifi.processors.evtx.parser.bxml.value.VariantTypeNode; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; import org.mockito.InOrder; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; @@ -55,7 +55,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class XmlBxmlNodeVisitorTest { @Mock private XMLStreamWriter xmlStreamWriter; @@ -69,7 +69,7 @@ public class XmlBxmlNodeVisitorTest { private List children; private XmlBxmlNodeVisitor xmlBxmlNodeVisitor; - @Before + @BeforeEach public void setup() throws IOException { substitutions = new ArrayList<>(); children = new ArrayList<>(Arrays.asList(bxmlNode)); diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/XmlRootNodeHandlerTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/XmlRootNodeHandlerTest.java index 7efd36ebe4..d822368e95 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/XmlRootNodeHandlerTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/XmlRootNodeHandlerTest.java @@ -17,21 +17,22 @@ package org.apache.nifi.processors.evtx; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import java.io.IOException; +import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class XmlRootNodeHandlerTest { @Mock XMLStreamWriter xmlStreamWriter; @@ -41,7 +42,7 @@ public class XmlRootNodeHandlerTest { XmlRootNodeHandler xmlRootNodeHandler; - @Before + @BeforeEach public void setup() throws IOException { xmlRootNodeHandler = new XmlRootNodeHandler(xmlStreamWriter, xmlBxmlNodeVisitorFactory); } @@ -52,11 +53,11 @@ public class XmlRootNodeHandlerTest { verify(xmlStreamWriter).writeStartElement(XmlRootNodeHandler.EVENTS); } - @Test(expected = IOException.class) - public void testConstructorException() throws XMLStreamException, IOException { + @Test + public void testConstructorException() throws XMLStreamException { xmlStreamWriter = mock(XMLStreamWriter.class); doThrow(new XMLStreamException()).when(xmlStreamWriter).writeStartElement(XmlRootNodeHandler.EVENTS); - new XmlRootNodeHandler(xmlStreamWriter, xmlBxmlNodeVisitorFactory); + assertThrows(IOException.class, () -> new XmlRootNodeHandler(xmlStreamWriter, xmlBxmlNodeVisitorFactory)); } @Test @@ -66,9 +67,9 @@ public class XmlRootNodeHandlerTest { verify(xmlStreamWriter).close(); } - @Test(expected = IOException.class) - public void testCloseException() throws IOException, XMLStreamException { + @Test + public void testCloseException() throws XMLStreamException { doThrow(new XMLStreamException()).when(xmlStreamWriter).close(); - xmlRootNodeHandler.close(); + assertThrows(IOException.class, () -> xmlRootNodeHandler.close()); } } diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/BinaryReaderTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/BinaryReaderTest.java index 10d403c3ee..595af3b9ba 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/BinaryReaderTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/BinaryReaderTest.java @@ -20,8 +20,8 @@ package org.apache.nifi.processors.evtx.parser; import com.google.common.base.Charsets; import com.google.common.primitives.UnsignedInteger; import com.google.common.primitives.UnsignedLong; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.io.ByteArrayInputStream; import java.io.IOException; @@ -31,11 +31,12 @@ import java.util.Date; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; public class BinaryReaderTest { private TestBinaryReaderBuilder testBinaryReaderBuilder; - @Before + @BeforeEach public void setup() { testBinaryReaderBuilder = new TestBinaryReaderBuilder(); } @@ -91,12 +92,12 @@ public class BinaryReaderTest { assertEquals(16, binaryReader.getPosition()); } - @Test(expected = IOException.class) + @Test public void testReadStringNotNullTerminated() throws IOException { String value = "Hello world"; BinaryReader binaryReader = testBinaryReaderBuilder.put(value.getBytes(Charsets.US_ASCII)).build(); - binaryReader.readString(value.length()); + assertThrows(IOException.class, () -> binaryReader.readString(value.length())); } @Test diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/ChunkHeaderTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/ChunkHeaderTest.java index 247d37fb0b..ab71c95bb6 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/ChunkHeaderTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/ChunkHeaderTest.java @@ -26,8 +26,8 @@ import org.apache.nifi.processors.evtx.parser.bxml.NameStringNodeTest; import org.apache.nifi.processors.evtx.parser.bxml.RootNode; import org.apache.nifi.processors.evtx.parser.bxml.TemplateNode; import org.apache.nifi.processors.evtx.parser.bxml.TemplateNodeTest; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.io.IOException; import java.util.ArrayList; @@ -59,7 +59,7 @@ public class ChunkHeaderTest { private int dataChecksum = 1111; private List guids; - @Before + @BeforeEach public void setup() throws IOException { TestBinaryReaderBuilder testBinaryReaderBuilder = new TestBinaryReaderBuilder(); testBinaryReaderBuilder.putString(ChunkHeader.ELF_CHNK); diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/FileHeaderTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/FileHeaderTest.java index 7a079812af..52cb74b025 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/FileHeaderTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/FileHeaderTest.java @@ -19,8 +19,8 @@ package org.apache.nifi.processors.evtx.parser; import com.google.common.primitives.UnsignedInteger; import org.apache.nifi.logging.ComponentLog; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.io.ByteArrayInputStream; import java.io.IOException; @@ -43,7 +43,7 @@ public class FileHeaderTest { private int chunkCount = 0; private int flags = 340942; - @Before + @BeforeEach public void setup() throws IOException { TestBinaryReaderBuilder testBinaryReaderBuilder = new TestBinaryReaderBuilder(); testBinaryReaderBuilder.putString(FileHeader.ELF_FILE); diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/RecordTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/RecordTest.java index 7bf6a10c0d..13fc5281ae 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/RecordTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/RecordTest.java @@ -20,11 +20,11 @@ package org.apache.nifi.processors.evtx.parser; import org.apache.nifi.processors.evtx.parser.bxml.BxmlNode; import org.apache.nifi.processors.evtx.parser.bxml.EndOfStreamNode; import org.apache.nifi.processors.evtx.parser.bxml.RootNode; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import java.io.IOException; import java.util.Date; @@ -33,7 +33,7 @@ import java.util.List; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public class RecordTest { @Mock ChunkHeader chunkHeader; @@ -53,7 +53,7 @@ public class RecordTest { testBinaryReaderBuilder.putDWord(size); } - @Before + @BeforeEach public void setup() throws IOException { TestBinaryReaderBuilder testBinaryReaderBuilder = new TestBinaryReaderBuilder(); putNode(testBinaryReaderBuilder, recordNum, new Date()); diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/AttributeNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/AttributeNodeTest.java index d6eb07d127..3811271ec2 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/AttributeNodeTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/AttributeNodeTest.java @@ -20,7 +20,8 @@ package org.apache.nifi.processors.evtx.parser.bxml; import org.apache.nifi.processors.evtx.parser.BinaryReader; import org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor; import org.apache.nifi.processors.evtx.parser.bxml.value.NullTypeNode; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.io.IOException; import java.util.List; @@ -37,6 +38,7 @@ public class AttributeNodeTest extends BxmlNodeWithTokenAndStringTestBase { private AttributeNode attributeNode; @Override + @BeforeEach public void setup() throws IOException { super.setup(); testBinaryReaderBuilder.put((byte) BxmlNode.VALUE_TOKEN); diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/BxmlNodeTestBase.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/BxmlNodeTestBase.java index badf952491..b0562ffaf7 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/BxmlNodeTestBase.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/BxmlNodeTestBase.java @@ -19,14 +19,14 @@ package org.apache.nifi.processors.evtx.parser.bxml; import org.apache.nifi.processors.evtx.parser.ChunkHeader; import org.apache.nifi.processors.evtx.parser.TestBinaryReaderBuilder; -import org.junit.Before; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import java.io.IOException; -@RunWith(MockitoJUnitRunner.class) +@ExtendWith(MockitoExtension.class) public abstract class BxmlNodeTestBase { public TestBinaryReaderBuilder testBinaryReaderBuilder; @@ -36,7 +36,7 @@ public abstract class BxmlNodeTestBase { @Mock public BxmlNode parent; - @Before + @BeforeEach public void setup() throws IOException { testBinaryReaderBuilder = new TestBinaryReaderBuilder(); } diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/CDataSectionNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/CDataSectionNodeTest.java index 118bdcce37..38184d9b58 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/CDataSectionNodeTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/CDataSectionNodeTest.java @@ -18,7 +18,8 @@ package org.apache.nifi.processors.evtx.parser.bxml; import org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.io.IOException; @@ -32,6 +33,7 @@ public class CDataSectionNodeTest extends BxmlNodeWithTokenTestBase { private CDataSectionNode cDataSectionNode; @Override + @BeforeEach public void setup() throws IOException { super.setup(); content = "cdata content"; diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/CloseElementNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/CloseElementNodeTest.java index f057ced640..f67bd46a58 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/CloseElementNodeTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/CloseElementNodeTest.java @@ -18,7 +18,8 @@ package org.apache.nifi.processors.evtx.parser.bxml; import org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.io.IOException; @@ -30,6 +31,7 @@ public class CloseElementNodeTest extends BxmlNodeWithTokenTestBase { private CloseElementNode closeElementNode; @Override + @BeforeEach public void setup() throws IOException { super.setup(); closeElementNode = new CloseElementNode(testBinaryReaderBuilder.build(), chunkHeader, parent); diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/CloseEmptyElementNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/CloseEmptyElementNodeTest.java index c63d9f8842..696b8e07cb 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/CloseEmptyElementNodeTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/CloseEmptyElementNodeTest.java @@ -18,7 +18,8 @@ package org.apache.nifi.processors.evtx.parser.bxml; import org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.io.IOException; @@ -31,6 +32,7 @@ public class CloseEmptyElementNodeTest extends BxmlNodeWithTokenTestBase { private CloseEmptyElementNode closeEmptyElementNode; @Override + @BeforeEach public void setup() throws IOException { super.setup(); closeEmptyElementNode = new CloseEmptyElementNode(testBinaryReaderBuilder.build(), chunkHeader, parent); diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/CloseStartElementNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/CloseStartElementNodeTest.java index c4338d76dc..5ff52b6d6e 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/CloseStartElementNodeTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/CloseStartElementNodeTest.java @@ -18,7 +18,8 @@ package org.apache.nifi.processors.evtx.parser.bxml; import org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.io.IOException; @@ -31,6 +32,7 @@ public class CloseStartElementNodeTest extends BxmlNodeWithTokenTestBase { private CloseStartElementNode closeStartElementNode; @Override + @BeforeEach public void setup() throws IOException { super.setup(); closeStartElementNode = new CloseStartElementNode(testBinaryReaderBuilder.build(), chunkHeader, parent); diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/ConditionalSubstitutionNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/ConditionalSubstitutionNodeTest.java index 048242c182..18ecfbcc6b 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/ConditionalSubstitutionNodeTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/ConditionalSubstitutionNodeTest.java @@ -18,7 +18,8 @@ package org.apache.nifi.processors.evtx.parser.bxml; import org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.io.IOException; @@ -33,6 +34,7 @@ public class ConditionalSubstitutionNodeTest extends BxmlNodeWithTokenTestBase { private byte type; @Override + @BeforeEach public void setup() throws IOException { super.setup(); index = 10; diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/EndOfStreamNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/EndOfStreamNodeTest.java index 5cd807e489..e4bece313a 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/EndOfStreamNodeTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/EndOfStreamNodeTest.java @@ -18,7 +18,8 @@ package org.apache.nifi.processors.evtx.parser.bxml; import org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.io.IOException; @@ -31,6 +32,7 @@ public class EndOfStreamNodeTest extends BxmlNodeWithTokenTestBase { private EndOfStreamNode endOfStreamNode; @Override + @BeforeEach public void setup() throws IOException { super.setup(); endOfStreamNode = new EndOfStreamNode(testBinaryReaderBuilder.build(), chunkHeader, parent); diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/EntityReferenceNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/EntityReferenceNodeTest.java index aafc4db20a..795af79921 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/EntityReferenceNodeTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/EntityReferenceNodeTest.java @@ -18,7 +18,8 @@ package org.apache.nifi.processors.evtx.parser.bxml; import org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.io.IOException; @@ -32,6 +33,7 @@ public class EntityReferenceNodeTest extends BxmlNodeWithTokenAndStringTestBase private EntityReferenceNode entityReferenceNode; @Override + @BeforeEach public void setup() throws IOException { super.setup(); entityReferenceNode = new EntityReferenceNode(testBinaryReaderBuilder.build(), chunkHeader, parent); diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/NameStringNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/NameStringNodeTest.java index 233559fe4a..eb29b31699 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/NameStringNodeTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/NameStringNodeTest.java @@ -20,7 +20,8 @@ package org.apache.nifi.processors.evtx.parser.bxml; import com.google.common.primitives.UnsignedInteger; import org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor; import org.apache.nifi.processors.evtx.parser.TestBinaryReaderBuilder; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.io.IOException; @@ -44,6 +45,7 @@ public class NameStringNodeTest extends BxmlNodeTestBase { } @Override + @BeforeEach public void setup() throws IOException { super.setup(); putNode(testBinaryReaderBuilder, nextOffset, hash, string); diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/NormalSubstitutionNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/NormalSubstitutionNodeTest.java index 3f59485989..7c03570579 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/NormalSubstitutionNodeTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/NormalSubstitutionNodeTest.java @@ -18,7 +18,8 @@ package org.apache.nifi.processors.evtx.parser.bxml; import org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.io.IOException; @@ -33,6 +34,7 @@ public class NormalSubstitutionNodeTest extends BxmlNodeWithTokenTestBase { private NormalSubstitutionNode normalSubstitutionNode; @Override + @BeforeEach public void setup() throws IOException { super.setup(); testBinaryReaderBuilder.putWord(index); diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/OpenStartElementNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/OpenStartElementNodeTest.java index 2b5952ad18..a072413c5b 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/OpenStartElementNodeTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/OpenStartElementNodeTest.java @@ -20,7 +20,8 @@ package org.apache.nifi.processors.evtx.parser.bxml; import org.apache.nifi.processors.evtx.parser.BinaryReader; import org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor; import org.apache.nifi.processors.evtx.parser.TestBinaryReaderBuilder; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.io.IOException; import java.util.List; @@ -40,6 +41,7 @@ public class OpenStartElementNodeTest extends BxmlNodeWithTokenTestBase { private OpenStartElementNode openStartElementNode; @Override + @BeforeEach public void setup() throws IOException { super.setup(); testBinaryReaderBuilder.putWord(unknown); diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/ProcessingInstructionDataNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/ProcessingInstructionDataNodeTest.java index f84589de9e..a311c6a080 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/ProcessingInstructionDataNodeTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/ProcessingInstructionDataNodeTest.java @@ -18,7 +18,8 @@ package org.apache.nifi.processors.evtx.parser.bxml; import org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.io.IOException; @@ -32,6 +33,7 @@ public class ProcessingInstructionDataNodeTest extends BxmlNodeWithTokenTestBase private ProcessingInstructionDataNode processingInstructionDataNode; @Override + @BeforeEach public void setup() throws IOException { super.setup(); testBinaryReaderBuilder.putWord(data.length()); diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/ProcessingInstructionTargetNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/ProcessingInstructionTargetNodeTest.java index e33ac0e1c1..9f199c25a9 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/ProcessingInstructionTargetNodeTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/ProcessingInstructionTargetNodeTest.java @@ -18,7 +18,8 @@ package org.apache.nifi.processors.evtx.parser.bxml; import org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.io.IOException; @@ -32,6 +33,7 @@ public class ProcessingInstructionTargetNodeTest extends BxmlNodeWithTokenAndStr private ProcessingInstructionTargetNode processingInstructionTargetNode; @Override + @BeforeEach public void setup() throws IOException { super.setup(); processingInstructionTargetNode = new ProcessingInstructionTargetNode(testBinaryReaderBuilder.build(), chunkHeader, parent); diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/RootNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/RootNodeTest.java index e14b9e20bb..db4ee84670 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/RootNodeTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/RootNodeTest.java @@ -19,7 +19,8 @@ package org.apache.nifi.processors.evtx.parser.bxml; import org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor; import org.apache.nifi.processors.evtx.parser.bxml.value.VariantTypeNode; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.io.IOException; import java.util.List; @@ -36,6 +37,7 @@ public class RootNodeTest extends BxmlNodeTestBase { private RootNode rootNode; @Override + @BeforeEach public void setup() throws IOException { super.setup(); testBinaryReaderBuilder.put((byte) BxmlNode.END_OF_STREAM_TOKEN); diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/StreamStartNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/StreamStartNodeTest.java index a698f4bc1e..36e0c86f29 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/StreamStartNodeTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/StreamStartNodeTest.java @@ -18,7 +18,8 @@ package org.apache.nifi.processors.evtx.parser.bxml; import org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.io.IOException; @@ -32,6 +33,7 @@ public class StreamStartNodeTest extends BxmlNodeWithTokenTestBase { private StreamStartNode streamStartNode; @Override + @BeforeEach public void setup() throws IOException { super.setup(); testBinaryReaderBuilder.put((byte) 1); diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/TemplateInstanceNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/TemplateInstanceNodeTest.java index 39032ad9f1..f6c0621655 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/TemplateInstanceNodeTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/TemplateInstanceNodeTest.java @@ -20,7 +20,8 @@ package org.apache.nifi.processors.evtx.parser.bxml; import com.google.common.primitives.UnsignedInteger; import org.apache.nifi.processors.evtx.parser.BinaryReader; import org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.io.IOException; @@ -40,6 +41,7 @@ public class TemplateInstanceNodeTest extends BxmlNodeWithTokenTestBase { private TemplateInstanceNode templateInstanceNode; @Override + @BeforeEach public void setup() throws IOException { super.setup(); testBinaryReaderBuilder.put(unknown); diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/TemplateNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/TemplateNodeTest.java index 87d5e34c55..7c4eeefd08 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/TemplateNodeTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/TemplateNodeTest.java @@ -20,7 +20,8 @@ package org.apache.nifi.processors.evtx.parser.bxml; import com.google.common.primitives.UnsignedInteger; import org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor; import org.apache.nifi.processors.evtx.parser.TestBinaryReaderBuilder; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.io.IOException; @@ -45,6 +46,7 @@ public class TemplateNodeTest extends BxmlNodeTestBase { } @Override + @BeforeEach public void setup() throws IOException { super.setup(); putNode(testBinaryReaderBuilder, nextOffset, guid, dataLength); diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/ValueNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/ValueNodeTest.java index 85b71ffd26..54927c07d6 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/ValueNodeTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/ValueNodeTest.java @@ -19,7 +19,8 @@ package org.apache.nifi.processors.evtx.parser.bxml; import org.apache.nifi.processors.evtx.parser.BxmlNodeVisitor; import org.apache.nifi.processors.evtx.parser.bxml.value.NullTypeNode; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.io.IOException; import java.util.List; @@ -34,6 +35,7 @@ public class ValueNodeTest extends BxmlNodeWithTokenTestBase { private ValueNode valueNode; @Override + @BeforeEach public void setup() throws IOException { super.setup(); testBinaryReaderBuilder.put((byte) 0); diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/BXmlTypeNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/BXmlTypeNodeTest.java index cf7e48a585..d0a27c00c5 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/BXmlTypeNodeTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/BXmlTypeNodeTest.java @@ -21,18 +21,20 @@ import org.apache.nifi.processors.evtx.parser.bxml.BxmlNode; import org.apache.nifi.processors.evtx.parser.bxml.BxmlNodeTestBase; import org.apache.nifi.processors.evtx.parser.bxml.EndOfStreamNode; import org.apache.nifi.processors.evtx.parser.bxml.RootNode; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.io.IOException; import java.util.List; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; public class BXmlTypeNodeTest extends BxmlNodeTestBase { private BXmlTypeNode bXmlTypeNode; @Override + @BeforeEach public void setup() throws IOException { super.setup(); testBinaryReaderBuilder.put((byte) BxmlNode.END_OF_STREAM_TOKEN); diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/BinaryTypeNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/BinaryTypeNodeTest.java index fd121a7f41..b51c838477 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/BinaryTypeNodeTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/BinaryTypeNodeTest.java @@ -21,12 +21,13 @@ import com.google.common.base.Charsets; import com.google.common.primitives.UnsignedInteger; import org.apache.nifi.processors.evtx.parser.BinaryReader; import org.apache.nifi.processors.evtx.parser.bxml.BxmlNodeTestBase; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.IOException; import java.util.Base64; import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; public class BinaryTypeNodeTest extends BxmlNodeTestBase { @Test @@ -36,11 +37,11 @@ public class BinaryTypeNodeTest extends BxmlNodeTestBase { assertEquals(Base64.getEncoder().encodeToString(val.getBytes(Charsets.US_ASCII)), new BinaryTypeNode(binaryReader, chunkHeader, parent, -1).getValue()); } - @Test(expected = IOException.class) + @Test public void testInvalidStringLength() throws IOException { String val = "Test String"; BinaryReader binaryReader = testBinaryReaderBuilder.putDWord(UnsignedInteger.fromIntBits(Integer.MAX_VALUE + 1)).putString(val).build(); - assertEquals(Base64.getEncoder().encodeToString(val.getBytes(Charsets.US_ASCII)), new BinaryTypeNode(binaryReader, chunkHeader, parent, -1).getValue()); + assertThrows(IOException.class, () -> assertEquals(Base64.getEncoder().encodeToString(val.getBytes(Charsets.US_ASCII)), new BinaryTypeNode(binaryReader, chunkHeader, parent, -1).getValue())); } @Test diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/BooleanTypeNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/BooleanTypeNodeTest.java index 13a75aa2f2..c9c065da31 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/BooleanTypeNodeTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/BooleanTypeNodeTest.java @@ -18,12 +18,12 @@ package org.apache.nifi.processors.evtx.parser.bxml.value; import org.apache.nifi.processors.evtx.parser.bxml.BxmlNodeTestBase; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.IOException; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; public class BooleanTypeNodeTest extends BxmlNodeTestBase { @Test diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/DoubleTypeNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/DoubleTypeNodeTest.java index 4705367c7a..7b077335fc 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/DoubleTypeNodeTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/DoubleTypeNodeTest.java @@ -18,11 +18,11 @@ package org.apache.nifi.processors.evtx.parser.bxml.value; import org.apache.nifi.processors.evtx.parser.bxml.BxmlNodeTestBase; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.IOException; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; public class DoubleTypeNodeTest extends BxmlNodeTestBase { @Test diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/FiletimeTypeNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/FiletimeTypeNodeTest.java index d81c1b6385..22f2ba10d7 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/FiletimeTypeNodeTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/FiletimeTypeNodeTest.java @@ -18,12 +18,12 @@ package org.apache.nifi.processors.evtx.parser.bxml.value; import org.apache.nifi.processors.evtx.parser.bxml.BxmlNodeTestBase; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.IOException; import java.util.Date; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; public class FiletimeTypeNodeTest extends BxmlNodeTestBase { @Test diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/FloatTypeNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/FloatTypeNodeTest.java index a4fe3db5ae..375cdd4f36 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/FloatTypeNodeTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/FloatTypeNodeTest.java @@ -18,11 +18,11 @@ package org.apache.nifi.processors.evtx.parser.bxml.value; import org.apache.nifi.processors.evtx.parser.bxml.BxmlNodeTestBase; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.IOException; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; public class FloatTypeNodeTest extends BxmlNodeTestBase { @Test diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/GuidTypeNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/GuidTypeNodeTest.java index f56086982a..1c81c2de1c 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/GuidTypeNodeTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/GuidTypeNodeTest.java @@ -18,11 +18,11 @@ package org.apache.nifi.processors.evtx.parser.bxml.value; import org.apache.nifi.processors.evtx.parser.bxml.BxmlNodeTestBase; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.IOException; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; public class GuidTypeNodeTest extends BxmlNodeTestBase { @Test diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/Hex32TypeNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/Hex32TypeNodeTest.java index b8ed300e74..3b9425bae1 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/Hex32TypeNodeTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/Hex32TypeNodeTest.java @@ -19,7 +19,7 @@ package org.apache.nifi.processors.evtx.parser.bxml.value; import com.google.common.primitives.UnsignedInteger; import org.apache.nifi.processors.evtx.parser.bxml.BxmlNodeTestBase; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.IOException; diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/Hex64TypeNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/Hex64TypeNodeTest.java index ecaa15644b..7836528b73 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/Hex64TypeNodeTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/Hex64TypeNodeTest.java @@ -19,7 +19,7 @@ package org.apache.nifi.processors.evtx.parser.bxml.value; import com.google.common.primitives.UnsignedLong; import org.apache.nifi.processors.evtx.parser.bxml.BxmlNodeTestBase; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.IOException; diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/NullTypeNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/NullTypeNodeTest.java index 99e7fb0cea..975984755a 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/NullTypeNodeTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/NullTypeNodeTest.java @@ -18,7 +18,7 @@ package org.apache.nifi.processors.evtx.parser.bxml.value; import org.apache.nifi.processors.evtx.parser.bxml.BxmlNodeTestBase; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.IOException; diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SIDTypeNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SIDTypeNodeTest.java index a87fd39dae..f29fabdd31 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SIDTypeNodeTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SIDTypeNodeTest.java @@ -18,7 +18,7 @@ package org.apache.nifi.processors.evtx.parser.bxml.value; import org.apache.nifi.processors.evtx.parser.bxml.BxmlNodeTestBase; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.IOException; diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SignedByteTypeNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SignedByteTypeNodeTest.java index a19c64e206..a1b37f72e9 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SignedByteTypeNodeTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SignedByteTypeNodeTest.java @@ -18,7 +18,7 @@ package org.apache.nifi.processors.evtx.parser.bxml.value; import org.apache.nifi.processors.evtx.parser.bxml.BxmlNodeTestBase; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.IOException; diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SignedDWordTypeNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SignedDWordTypeNodeTest.java index 514145bc94..5c3d0cda13 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SignedDWordTypeNodeTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SignedDWordTypeNodeTest.java @@ -18,7 +18,7 @@ package org.apache.nifi.processors.evtx.parser.bxml.value; import org.apache.nifi.processors.evtx.parser.bxml.BxmlNodeTestBase; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.IOException; diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SignedQWordTypeNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SignedQWordTypeNodeTest.java index a76baa6c13..5c0cebe1cf 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SignedQWordTypeNodeTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SignedQWordTypeNodeTest.java @@ -18,7 +18,7 @@ package org.apache.nifi.processors.evtx.parser.bxml.value; import org.apache.nifi.processors.evtx.parser.bxml.BxmlNodeTestBase; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.IOException; diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SignedWordTypeNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SignedWordTypeNodeTest.java index 3a880af8ac..55a3ac5c05 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SignedWordTypeNodeTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SignedWordTypeNodeTest.java @@ -18,7 +18,7 @@ package org.apache.nifi.processors.evtx.parser.bxml.value; import org.apache.nifi.processors.evtx.parser.bxml.BxmlNodeTestBase; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.IOException; diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SizeTypeNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SizeTypeNodeTest.java index c654ce02b5..7763ffdf6f 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SizeTypeNodeTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SizeTypeNodeTest.java @@ -20,7 +20,7 @@ package org.apache.nifi.processors.evtx.parser.bxml.value; import com.google.common.primitives.UnsignedInteger; import com.google.common.primitives.UnsignedLong; import org.apache.nifi.processors.evtx.parser.bxml.BxmlNodeTestBase; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.IOException; diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/StringTypeNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/StringTypeNodeTest.java index 1ade111987..26b9ba4772 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/StringTypeNodeTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/StringTypeNodeTest.java @@ -19,7 +19,7 @@ package org.apache.nifi.processors.evtx.parser.bxml.value; import org.apache.nifi.processors.evtx.parser.BinaryReader; import org.apache.nifi.processors.evtx.parser.bxml.BxmlNodeTestBase; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.IOException; diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SystemtimeTypeNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SystemtimeTypeNodeTest.java index 128a161ffb..bdb7512019 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SystemtimeTypeNodeTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/SystemtimeTypeNodeTest.java @@ -18,7 +18,7 @@ package org.apache.nifi.processors.evtx.parser.bxml.value; import org.apache.nifi.processors.evtx.parser.bxml.BxmlNodeTestBase; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.IOException; import java.util.Calendar; diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/UnsignedByteTypeNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/UnsignedByteTypeNodeTest.java index 0622a4380a..c25b128869 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/UnsignedByteTypeNodeTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/UnsignedByteTypeNodeTest.java @@ -18,7 +18,7 @@ package org.apache.nifi.processors.evtx.parser.bxml.value; import org.apache.nifi.processors.evtx.parser.bxml.BxmlNodeTestBase; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.IOException; diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/UnsignedDWordTypeNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/UnsignedDWordTypeNodeTest.java index 575a892dda..13b9525d62 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/UnsignedDWordTypeNodeTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/UnsignedDWordTypeNodeTest.java @@ -19,7 +19,7 @@ package org.apache.nifi.processors.evtx.parser.bxml.value; import com.google.common.primitives.UnsignedInteger; import org.apache.nifi.processors.evtx.parser.bxml.BxmlNodeTestBase; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.IOException; diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/UnsignedQWordTypeNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/UnsignedQWordTypeNodeTest.java index 7bd9f7b80c..b22acf303c 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/UnsignedQWordTypeNodeTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/UnsignedQWordTypeNodeTest.java @@ -19,7 +19,7 @@ package org.apache.nifi.processors.evtx.parser.bxml.value; import com.google.common.primitives.UnsignedLong; import org.apache.nifi.processors.evtx.parser.bxml.BxmlNodeTestBase; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.IOException; diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/UnsignedWordTypeNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/UnsignedWordTypeNodeTest.java index 5d9614fa5b..d57511eb9c 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/UnsignedWordTypeNodeTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/UnsignedWordTypeNodeTest.java @@ -18,7 +18,7 @@ package org.apache.nifi.processors.evtx.parser.bxml.value; import org.apache.nifi.processors.evtx.parser.bxml.BxmlNodeTestBase; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.IOException; diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/WStringArrayTypeNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/WStringArrayTypeNodeTest.java index c17a095d66..01afc37182 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/WStringArrayTypeNodeTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/WStringArrayTypeNodeTest.java @@ -18,7 +18,7 @@ package org.apache.nifi.processors.evtx.parser.bxml.value; import org.apache.nifi.processors.evtx.parser.bxml.BxmlNodeTestBase; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.IOException; diff --git a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/WStringTypeNodeTest.java b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/WStringTypeNodeTest.java index c7ad3d7e66..e1951943e2 100644 --- a/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/WStringTypeNodeTest.java +++ b/nifi-nar-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/WStringTypeNodeTest.java @@ -18,7 +18,7 @@ package org.apache.nifi.processors.evtx.parser.bxml.value; import org.apache.nifi.processors.evtx.parser.bxml.BxmlNodeTestBase; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.IOException; diff --git a/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/ExecuteFlumeSinkTest.java b/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/ExecuteFlumeSinkTest.java index 09ccdf0e97..02d7766168 100644 --- a/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/ExecuteFlumeSinkTest.java +++ b/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/ExecuteFlumeSinkTest.java @@ -16,18 +16,6 @@ */ package org.apache.nifi.processors.flume; -import java.io.File; - -import static org.junit.Assert.assertEquals; - -import java.io.FilenameFilter; -import java.io.IOException; -import java.io.InputStream; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; - import org.apache.commons.io.filefilter.HiddenFileFilter; import org.apache.flume.sink.NullSink; import org.apache.flume.source.AvroSource; @@ -39,22 +27,31 @@ import org.apache.nifi.util.TestRunner; import org.apache.nifi.util.TestRunners; import org.apache.nifi.util.file.FileUtils; import org.apache.nifi.util.security.MessageDigestUtils; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.io.File; +import java.io.FilenameFilter; +import java.io.IOException; +import java.io.InputStream; +import java.nio.file.Path; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + public class ExecuteFlumeSinkTest { private static final Logger logger = LoggerFactory.getLogger(ExecuteFlumeSinkTest.class); - @Rule - public final TemporaryFolder temp = new TemporaryFolder(); - @Test public void testValidators() { TestRunner runner = TestRunners.newTestRunner(ExecuteFlumeSink.class); @@ -67,10 +64,10 @@ public class ExecuteFlumeSinkTest { if (pc instanceof MockProcessContext) { results = ((MockProcessContext) pc).validate(); } - Assert.assertEquals(1, results.size()); + assertEquals(1, results.size()); for (ValidationResult vr : results) { logger.debug(vr.toString()); - Assert.assertTrue(vr.toString().contains("is invalid because Sink Type is required")); + assertTrue(vr.toString().contains("is invalid because Sink Type is required")); } // non-existent class @@ -81,10 +78,10 @@ public class ExecuteFlumeSinkTest { if (pc instanceof MockProcessContext) { results = ((MockProcessContext) pc).validate(); } - Assert.assertEquals(1, results.size()); + assertEquals(1, results.size()); for (ValidationResult vr : results) { logger.debug(vr.toString()); - Assert.assertTrue(vr.toString().contains("is invalid because unable to load sink")); + assertTrue(vr.toString().contains("is invalid because unable to load sink")); } // class doesn't implement Sink @@ -95,10 +92,10 @@ public class ExecuteFlumeSinkTest { if (pc instanceof MockProcessContext) { results = ((MockProcessContext) pc).validate(); } - Assert.assertEquals(1, results.size()); + assertEquals(1, results.size()); for (ValidationResult vr : results) { logger.debug(vr.toString()); - Assert.assertTrue(vr.toString().contains("is invalid because unable to create sink")); + assertTrue(vr.toString().contains("is invalid because unable to create sink")); } results = new HashSet<>(); @@ -108,7 +105,7 @@ public class ExecuteFlumeSinkTest { if (pc instanceof MockProcessContext) { results = ((MockProcessContext) pc).validate(); } - Assert.assertEquals(0, results.size()); + assertEquals(0, results.size()); } @@ -137,9 +134,10 @@ public class ExecuteFlumeSinkTest { } @Test - @Ignore("Does not work on Windows") - public void testHdfsSink() throws IOException { - File destDir = temp.newFolder("hdfs"); + @Disabled("Does not work on Windows") + public void testHdfsSink(@TempDir Path temp) throws IOException { + File destDir = temp.resolve("hdfs").toFile(); + destDir.mkdirs(); TestRunner runner = TestRunners.newTestRunner(ExecuteFlumeSink.class); runner.setProperty(ExecuteFlumeSink.SINK_TYPE, "hdfs"); @@ -157,14 +155,14 @@ public class ExecuteFlumeSinkTest { } File[] files = destDir.listFiles((FilenameFilter)HiddenFileFilter.VISIBLE); - assertEquals("Unexpected number of destination files.", 1, files.length); + assertEquals(1, files.length, "Unexpected number of destination files."); File dst = files[0]; byte[] expectedDigest; try (InputStream resourceStream = getClass().getResourceAsStream("/testdata/records.txt")) { expectedDigest = MessageDigestUtils.getDigest(resourceStream); } byte[] actualDigest = FileUtils.computeDigest(dst); - Assert.assertArrayEquals("Destination file doesn't match source data", expectedDigest, actualDigest); + assertArrayEquals(expectedDigest, actualDigest, "Destination file doesn't match source data"); } } diff --git a/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/ExecuteFlumeSourceTest.java b/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/ExecuteFlumeSourceTest.java index 2f40e5c782..7c21fb5580 100644 --- a/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/ExecuteFlumeSourceTest.java +++ b/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/ExecuteFlumeSourceTest.java @@ -17,13 +17,6 @@ package org.apache.nifi.processors.flume; -import java.io.File; -import java.io.IOException; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.concurrent.TimeUnit; - import org.apache.flume.sink.NullSink; import org.apache.flume.source.AvroSource; import org.apache.nifi.components.ValidationResult; @@ -33,21 +26,27 @@ import org.apache.nifi.util.MockProcessContext; import org.apache.nifi.util.TestRunner; import org.apache.nifi.util.TestRunners; import org.apache.nifi.util.file.FileUtils; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.io.File; +import java.io.IOException; +import java.nio.file.Path; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.concurrent.TimeUnit; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + public class ExecuteFlumeSourceTest { private static final Logger logger = LoggerFactory.getLogger(ExecuteFlumeSourceTest.class); - @Rule - public final TemporaryFolder temp = new TemporaryFolder(); - @Test public void testValidators() { TestRunner runner = TestRunners.newTestRunner(ExecuteFlumeSource.class); @@ -60,10 +59,10 @@ public class ExecuteFlumeSourceTest { if (pc instanceof MockProcessContext) { results = ((MockProcessContext) pc).validate(); } - Assert.assertEquals(1, results.size()); + assertEquals(1, results.size()); for (ValidationResult vr : results) { logger.debug(vr.toString()); - Assert.assertTrue(vr.toString().contains("is invalid because Source Type is required")); + assertTrue(vr.toString().contains("is invalid because Source Type is required")); } // non-existent class @@ -74,10 +73,10 @@ public class ExecuteFlumeSourceTest { if (pc instanceof MockProcessContext) { results = ((MockProcessContext) pc).validate(); } - Assert.assertEquals(1, results.size()); + assertEquals(1, results.size()); for (ValidationResult vr : results) { logger.debug(vr.toString()); - Assert.assertTrue(vr.toString().contains("is invalid because unable to load source")); + assertTrue(vr.toString().contains("is invalid because unable to load source")); } // class doesn't implement Source @@ -88,10 +87,10 @@ public class ExecuteFlumeSourceTest { if (pc instanceof MockProcessContext) { results = ((MockProcessContext) pc).validate(); } - Assert.assertEquals(1, results.size()); + assertEquals(1, results.size()); for (ValidationResult vr : results) { logger.debug(vr.toString()); - Assert.assertTrue(vr.toString().contains("is invalid because unable to create source")); + assertTrue(vr.toString().contains("is invalid because unable to create source")); } results = new HashSet<>(); @@ -101,7 +100,7 @@ public class ExecuteFlumeSourceTest { if (pc instanceof MockProcessContext) { results = ((MockProcessContext) pc).validate(); } - Assert.assertEquals(0, results.size()); + assertEquals(0, results.size()); } @Test @@ -110,17 +109,18 @@ public class ExecuteFlumeSourceTest { runner.setProperty(ExecuteFlumeSource.SOURCE_TYPE, "seq"); runner.run(); List flowFiles = runner.getFlowFilesForRelationship(ExecuteFlumeSource.SUCCESS); - Assert.assertEquals(1, flowFiles.size()); + assertEquals(1, flowFiles.size()); for (MockFlowFile flowFile : flowFiles) { logger.debug(flowFile.toString()); - Assert.assertEquals(1, flowFile.getSize()); + assertEquals(1, flowFile.getSize()); } } @Test - @Ignore("Does not work on Windows") - public void testSourceWithConfig() throws IOException { - File spoolDirectory = temp.newFolder("spooldir"); + @Disabled("Does not work on Windows") + public void testSourceWithConfig(@TempDir Path temp) throws IOException { + File spoolDirectory = temp.resolve("spooldir").toFile(); + spoolDirectory.mkdirs(); File dst = new File(spoolDirectory, "records.txt"); FileUtils.copyFile(getClass().getResourceAsStream("/testdata/records.txt"), dst, true, false); diff --git a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/pom.xml b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/pom.xml index a2dbccfeb5..65b5596617 100644 --- a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/pom.xml +++ b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/pom.xml @@ -171,7 +171,6 @@ org.apache.maven.plugins maven-failsafe-plugin - org.apache.nifi.processors.gcp.GCPIntegrationTests ${skipGCPIntegrationTests} @@ -179,7 +178,6 @@ org.apache.maven.plugins maven-surefire-plugin - org.apache.nifi.processors.gcp.GCPIntegrationTests ${project.basedir}/src/test/resources/mock-gcp-application-default-credentials.json diff --git a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/bigquery/AbstractBQTest.java b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/bigquery/AbstractBQTest.java index e424a3a82b..9aa8a469e5 100644 --- a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/bigquery/AbstractBQTest.java +++ b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/bigquery/AbstractBQTest.java @@ -26,8 +26,8 @@ import org.apache.nifi.processor.Processor; import org.apache.nifi.processors.gcp.credentials.service.GCPCredentialsControllerService; import org.apache.nifi.util.TestRunner; import org.apache.nifi.util.TestRunners; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; @@ -45,7 +45,7 @@ public abstract class AbstractBQTest { static final String DATASET = RemoteBigQueryHelper.generateDatasetName(); - @Before + @BeforeEach public void setup() throws Exception { MockitoAnnotations.initMocks(this); } diff --git a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/bigquery/AbstractBigQueryIT.java b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/bigquery/AbstractBigQueryIT.java index cba730fb02..ed49e12a75 100644 --- a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/bigquery/AbstractBigQueryIT.java +++ b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/bigquery/AbstractBigQueryIT.java @@ -17,33 +17,29 @@ package org.apache.nifi.processors.gcp.bigquery; -import static org.junit.Assert.assertNull; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; - -import org.apache.nifi.components.PropertyDescriptor; -import org.apache.nifi.flowfile.FlowFile; -import org.apache.nifi.processors.gcp.GCPIntegrationTests; -import org.apache.nifi.processors.gcp.ProxyAwareTransportFactory; -import org.apache.nifi.processors.gcp.credentials.factory.CredentialPropertyDescriptors; -import org.apache.nifi.processors.gcp.credentials.factory.CredentialsFactory; -import org.apache.nifi.processors.gcp.credentials.service.GCPCredentialsControllerService; -import org.apache.nifi.reporting.InitializationException; -import org.apache.nifi.util.TestRunner; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.experimental.categories.Category; - import com.google.auth.Credentials; import com.google.cloud.bigquery.BigQuery; import com.google.cloud.bigquery.BigQueryOptions; import com.google.cloud.bigquery.Dataset; import com.google.cloud.bigquery.DatasetInfo; import com.google.cloud.bigquery.testing.RemoteBigQueryHelper; +import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.flowfile.FlowFile; +import org.apache.nifi.processors.gcp.ProxyAwareTransportFactory; +import org.apache.nifi.processors.gcp.credentials.factory.CredentialPropertyDescriptors; +import org.apache.nifi.processors.gcp.credentials.factory.CredentialsFactory; +import org.apache.nifi.processors.gcp.credentials.service.GCPCredentialsControllerService; +import org.apache.nifi.reporting.InitializationException; +import org.apache.nifi.util.TestRunner; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import static org.junit.Assert.assertNull; -@Category(GCPIntegrationTests.class) public abstract class AbstractBigQueryIT { protected static final String CONTROLLER_SERVICE = "GCPCredentialsService"; @@ -56,7 +52,7 @@ public abstract class AbstractBigQueryIT { private static final CredentialsFactory credentialsProviderFactory = new CredentialsFactory(); - @BeforeClass + @BeforeAll public static void beforeClass() throws IOException { final Map propertiesMap = new HashMap<>(); propertiesMap.put(CredentialPropertyDescriptors.SERVICE_ACCOUNT_JSON_FILE, SERVICE_ACCOUNT_JSON); @@ -73,7 +69,7 @@ public abstract class AbstractBigQueryIT { dataset = bigquery.create(datasetInfo); } - @AfterClass + @AfterAll public static void afterClass() { bigquery.delete(dataset.getDatasetId(), BigQuery.DatasetDeleteOption.deleteContents()); } diff --git a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/bigquery/PutBigQueryBatchIT.java b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/bigquery/PutBigQueryBatchIT.java index 82e7748d34..622a8e5684 100644 --- a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/bigquery/PutBigQueryBatchIT.java +++ b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/bigquery/PutBigQueryBatchIT.java @@ -17,6 +17,14 @@ package org.apache.nifi.processors.gcp.bigquery; +import com.google.cloud.bigquery.FormatOptions; +import org.apache.nifi.processors.gcp.AbstractGCPProcessor; +import org.apache.nifi.reporting.InitializationException; +import org.apache.nifi.util.MockFlowFile; +import org.apache.nifi.util.TestRunners; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + import java.io.BufferedWriter; import java.io.ByteArrayInputStream; import java.io.IOException; @@ -24,15 +32,6 @@ import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; -import org.apache.nifi.processors.gcp.AbstractGCPProcessor; -import org.apache.nifi.reporting.InitializationException; -import org.apache.nifi.util.MockFlowFile; -import org.apache.nifi.util.TestRunners; -import org.junit.Before; -import org.junit.Test; - -import com.google.cloud.bigquery.FormatOptions; - public class PutBigQueryBatchIT extends AbstractBigQueryIT { private static final String TABLE_SCHEMA_STRING = "[\n" + @@ -56,7 +55,7 @@ public class PutBigQueryBatchIT extends AbstractBigQueryIT { " }\n" + "]"; - @Before + @BeforeEach public void setup() { runner = TestRunners.newTestRunner(PutBigQueryBatch.class); runner.setProperty(AbstractBigQueryProcessor.PROJECT_ID, PROJECT_ID); diff --git a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/bigquery/PutBigQueryBatchTest.java b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/bigquery/PutBigQueryBatchTest.java index 8561e62272..35a72b5ca8 100644 --- a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/bigquery/PutBigQueryBatchTest.java +++ b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/bigquery/PutBigQueryBatchTest.java @@ -32,8 +32,8 @@ import org.apache.nifi.components.ConfigVerificationResult; import org.apache.nifi.processor.ProcessContext; import org.apache.nifi.processor.VerifiableProcessor; import org.apache.nifi.util.TestRunner; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentMatchers; import org.mockito.Mock; @@ -79,7 +79,7 @@ public class PutBigQueryBatchTest extends AbstractBQTest { @Mock TableDataWriteChannel tableDataWriteChannel; - @Before + @BeforeEach public void setup() throws Exception { super.setup(); reset(bq); diff --git a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/bigquery/PutBigQueryStreamingIT.java b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/bigquery/PutBigQueryStreamingIT.java index fe233b6e7b..002258e13e 100644 --- a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/bigquery/PutBigQueryStreamingIT.java +++ b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/bigquery/PutBigQueryStreamingIT.java @@ -17,26 +17,6 @@ package org.apache.nifi.processors.gcp.bigquery; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -import java.nio.file.Files; -import java.nio.file.Paths; -import java.time.LocalDateTime; -import java.time.ZoneOffset; -import java.time.format.DateTimeFormatter; -import java.util.Iterator; - -import org.apache.nifi.json.JsonTreeReader; -import org.apache.nifi.processors.gcp.AbstractGCPProcessor; -import org.apache.nifi.reporting.InitializationException; -import org.apache.nifi.schema.access.SchemaAccessUtils; -import org.apache.nifi.serialization.DateTimeUtils; -import org.apache.nifi.util.TestRunners; -import org.junit.Before; -import org.junit.Test; - import com.google.cloud.bigquery.Field; import com.google.cloud.bigquery.Field.Mode; import com.google.cloud.bigquery.FieldValueList; @@ -47,12 +27,31 @@ import com.google.cloud.bigquery.TableDefinition; import com.google.cloud.bigquery.TableId; import com.google.cloud.bigquery.TableInfo; import com.google.cloud.bigquery.TableResult; +import org.apache.nifi.json.JsonTreeReader; +import org.apache.nifi.processors.gcp.AbstractGCPProcessor; +import org.apache.nifi.reporting.InitializationException; +import org.apache.nifi.schema.access.SchemaAccessUtils; +import org.apache.nifi.serialization.DateTimeUtils; +import org.apache.nifi.util.TestRunners; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.nio.file.Files; +import java.nio.file.Paths; +import java.time.LocalDateTime; +import java.time.ZoneOffset; +import java.time.format.DateTimeFormatter; +import java.util.Iterator; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; public class PutBigQueryStreamingIT extends AbstractBigQueryIT { private Schema schema; - @Before + @BeforeEach public void setup() throws InitializationException { runner = TestRunners.newTestRunner(PutBigQueryStreaming.class); runner = setCredentialsControllerService(runner); diff --git a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/credentials/factory/CredentialsFactoryTest.java b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/credentials/factory/CredentialsFactoryTest.java index 6ee8c10b0b..c198188a6a 100644 --- a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/credentials/factory/CredentialsFactoryTest.java +++ b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/credentials/factory/CredentialsFactoryTest.java @@ -25,7 +25,7 @@ import com.google.auth.oauth2.ServiceAccountCredentials; import org.apache.nifi.components.PropertyDescriptor; import org.apache.nifi.util.TestRunner; import org.apache.nifi.util.TestRunners; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.lang.reflect.Constructor; import java.lang.reflect.Modifier; diff --git a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/credentials/service/GCPCredentialsServiceTest.java b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/credentials/service/GCPCredentialsServiceTest.java index 5f61cf273b..ef251ec2dc 100644 --- a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/credentials/service/GCPCredentialsServiceTest.java +++ b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/credentials/service/GCPCredentialsServiceTest.java @@ -18,13 +18,13 @@ package org.apache.nifi.processors.gcp.credentials.service; import com.google.auth.oauth2.GoogleCredentials; import com.google.auth.oauth2.ServiceAccountCredentials; +import org.apache.nifi.gcp.credentials.service.GCPCredentialsService; import org.apache.nifi.util.TestRunner; import org.apache.nifi.util.TestRunners; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.nio.file.Files; import java.nio.file.Paths; -import org.apache.nifi.gcp.credentials.service.GCPCredentialsService; import static org.apache.nifi.processors.gcp.credentials.factory.CredentialPropertyDescriptors.SERVICE_ACCOUNT_JSON; import static org.apache.nifi.processors.gcp.credentials.factory.CredentialPropertyDescriptors.SERVICE_ACCOUNT_JSON_FILE; diff --git a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/pubsub/ConsumeGCPubSubIT.java b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/pubsub/ConsumeGCPubSubIT.java index e36d31c529..0d7a1da562 100644 --- a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/pubsub/ConsumeGCPubSubIT.java +++ b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/pubsub/ConsumeGCPubSubIT.java @@ -18,8 +18,8 @@ package org.apache.nifi.processors.gcp.pubsub; import org.apache.nifi.reporting.InitializationException; import org.apache.nifi.util.TestRunners; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import static org.apache.nifi.processors.gcp.pubsub.PubSubAttributes.ACK_ID_ATTRIBUTE; import static org.apache.nifi.processors.gcp.pubsub.PubSubAttributes.MSG_ATTRIBUTES_COUNT_ATTRIBUTE; @@ -27,7 +27,7 @@ import static org.apache.nifi.processors.gcp.pubsub.PubSubAttributes.MSG_PUBLISH public class ConsumeGCPubSubIT extends AbstractGCPubSubIT{ - @BeforeClass + @BeforeAll public static void setup() throws InitializationException { runner = TestRunners.newTestRunner(ConsumeGCPubSub.class); } diff --git a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/pubsub/PublishGCPubSubIT.java b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/pubsub/PublishGCPubSubIT.java index b774db82f2..145eb2b21a 100644 --- a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/pubsub/PublishGCPubSubIT.java +++ b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/pubsub/PublishGCPubSubIT.java @@ -18,15 +18,15 @@ package org.apache.nifi.processors.gcp.pubsub; import org.apache.nifi.reporting.InitializationException; import org.apache.nifi.util.TestRunners; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import static org.apache.nifi.processors.gcp.pubsub.PubSubAttributes.MESSAGE_ID_ATTRIBUTE; import static org.apache.nifi.processors.gcp.pubsub.PubSubAttributes.TOPIC_NAME_ATTRIBUTE; public class PublishGCPubSubIT extends AbstractGCPubSubIT{ - @BeforeClass + @BeforeAll public static void setup() throws InitializationException { runner = TestRunners.newTestRunner(PublishGCPubSub.class); } diff --git a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/AbstractGCSIT.java b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/AbstractGCSIT.java index d66df784e3..e76af49bc5 100644 --- a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/AbstractGCSIT.java +++ b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/AbstractGCSIT.java @@ -24,13 +24,11 @@ import com.google.cloud.storage.Storage; import com.google.cloud.storage.StorageException; import com.google.cloud.storage.testing.RemoteStorageHelper; import org.apache.nifi.processor.Processor; -import org.apache.nifi.processors.gcp.GCPIntegrationTests; import org.apache.nifi.processors.gcp.credentials.service.GCPCredentialsControllerService; import org.apache.nifi.util.TestRunner; import org.apache.nifi.util.TestRunners; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.experimental.categories.Category; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; import java.util.Arrays; @@ -41,7 +39,6 @@ import static org.junit.Assert.fail; * Assumes use of Application Default * credentials for running tests. */ -@Category(GCPIntegrationTests.class) public abstract class AbstractGCSIT { private static final String PROJECT_ID = System.getProperty("test.gcp.project.id", "nifi-test-gcp-project"); protected static final String BUCKET = RemoteStorageHelper.generateBucketName(); @@ -51,7 +48,7 @@ public abstract class AbstractGCSIT { protected static RemoteStorageHelper helper; protected static Storage storage; - @BeforeClass + @BeforeAll public static void setUp() { try { helper = RemoteStorageHelper.create(); @@ -73,7 +70,7 @@ public abstract class AbstractGCSIT { } } - @AfterClass + @AfterAll public static void tearDown() { try { // Empty the bucket before deleting it. diff --git a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/AbstractGCSTest.java b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/AbstractGCSTest.java index 4c267e9776..a35db57898 100644 --- a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/AbstractGCSTest.java +++ b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/AbstractGCSTest.java @@ -26,9 +26,12 @@ import org.apache.nifi.processor.Processor; import org.apache.nifi.processors.gcp.credentials.service.GCPCredentialsControllerService; import org.apache.nifi.util.TestRunner; import org.apache.nifi.util.TestRunners; + +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; +import org.mockito.MockitoAnnotations; import org.mockito.junit.jupiter.MockitoExtension; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -46,6 +49,11 @@ public abstract class AbstractGCSTest { static final String BUCKET = RemoteStorageHelper.generateBucketName(); + @BeforeEach + public void setup() throws Exception { + MockitoAnnotations.initMocks(this); + } + public static TestRunner buildNewRunner(Processor processor) throws Exception { final GCPCredentialsService credentialsService = new GCPCredentialsControllerService(); diff --git a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/DeleteGCSObjectIT.java b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/DeleteGCSObjectIT.java index 45a393f39c..02db5ee910 100644 --- a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/DeleteGCSObjectIT.java +++ b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/DeleteGCSObjectIT.java @@ -18,7 +18,7 @@ package org.apache.nifi.processors.gcp.storage; import org.apache.nifi.flowfile.attributes.CoreAttributes; import org.apache.nifi.util.TestRunner; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.Collections; diff --git a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/DeleteGCSObjectTest.java b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/DeleteGCSObjectTest.java index 5b751217b2..625cdd377a 100644 --- a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/DeleteGCSObjectTest.java +++ b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/DeleteGCSObjectTest.java @@ -20,9 +20,12 @@ import com.google.cloud.storage.BlobId; import com.google.cloud.storage.Storage; import com.google.cloud.storage.StorageException; import org.apache.nifi.util.TestRunner; + +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; +import org.mockito.MockitoAnnotations; import org.mockito.junit.jupiter.MockitoExtension; import java.util.LinkedHashMap; @@ -50,6 +53,11 @@ public class DeleteGCSObjectTest extends AbstractGCSTest { @Mock Storage storage; + @BeforeEach + public void setup() throws Exception { + MockitoAnnotations.initMocks(this); + } + @Override protected void addRequiredPropertiesToRunner(TestRunner runner) { runner.setProperty(DeleteGCSObject.BUCKET, BUCKET); diff --git a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/FetchGCSObjectIT.java b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/FetchGCSObjectIT.java index c5e5755999..fa8f1c5deb 100644 --- a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/FetchGCSObjectIT.java +++ b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/FetchGCSObjectIT.java @@ -19,7 +19,7 @@ package org.apache.nifi.processors.gcp.storage; import org.apache.nifi.components.ConfigVerificationResult; import org.apache.nifi.util.MockFlowFile; import org.apache.nifi.util.TestRunner; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.Collections; import java.util.HashMap; diff --git a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/FetchGCSObjectTest.java b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/FetchGCSObjectTest.java index a43c3c94aa..c98702d6d2 100644 --- a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/FetchGCSObjectTest.java +++ b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/FetchGCSObjectTest.java @@ -28,10 +28,13 @@ import org.apache.nifi.flowfile.attributes.CoreAttributes; import org.apache.nifi.processor.ProcessContext; import org.apache.nifi.util.MockFlowFile; import org.apache.nifi.util.TestRunner; + +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; import org.mockito.Mock; +import org.mockito.MockitoAnnotations; import org.mockito.junit.jupiter.MockitoExtension; import java.io.IOException; @@ -106,6 +109,11 @@ public class FetchGCSObjectTest extends AbstractGCSTest { @Mock Storage storage; + @BeforeEach + public void setup() throws Exception { + MockitoAnnotations.initMocks(this); + } + @Override public AbstractGCSProcessor getProcessor() { return new FetchGCSObject() { diff --git a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/ListGCSBucketIT.java b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/ListGCSBucketIT.java index 497e8e0e6a..333d1fc937 100644 --- a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/ListGCSBucketIT.java +++ b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/ListGCSBucketIT.java @@ -19,7 +19,7 @@ package org.apache.nifi.processors.gcp.storage; import com.google.cloud.storage.BucketInfo; import org.apache.nifi.util.MockFlowFile; import org.apache.nifi.util.TestRunner; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.List; diff --git a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/PutGCSObjectIT.java b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/PutGCSObjectIT.java index 9c1401377c..96a4004680 100644 --- a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/PutGCSObjectIT.java +++ b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/PutGCSObjectIT.java @@ -21,7 +21,7 @@ import com.google.cloud.storage.Blob; import com.google.cloud.storage.BlobId; import org.apache.nifi.util.MockFlowFile; import org.apache.nifi.util.TestRunner; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.Map; diff --git a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/PutGCSObjectTest.java b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/PutGCSObjectTest.java index 3596771613..1d463f8e92 100644 --- a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/PutGCSObjectTest.java +++ b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/PutGCSObjectTest.java @@ -16,6 +16,26 @@ */ package org.apache.nifi.processors.gcp.storage; +import com.google.cloud.storage.Acl; +import com.google.cloud.storage.Blob; +import com.google.cloud.storage.BlobInfo; +import com.google.cloud.storage.Storage; +import com.google.cloud.storage.StorageException; +import org.apache.nifi.flowfile.attributes.CoreAttributes; +import org.apache.nifi.util.MockFlowFile; +import org.apache.nifi.util.TestRunner; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; +import org.mockito.Mock; + +import java.io.InputStream; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + import static com.google.cloud.storage.Storage.PredefinedAcl.BUCKET_OWNER_READ; import static org.apache.nifi.processors.gcp.storage.StorageAttributes.BUCKET_ATTR; import static org.apache.nifi.processors.gcp.storage.StorageAttributes.CACHE_CONTROL_ATTR; @@ -48,25 +68,6 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.reset; import static org.mockito.Mockito.when; -import com.google.cloud.storage.Acl; -import com.google.cloud.storage.Blob; -import com.google.cloud.storage.BlobInfo; -import com.google.cloud.storage.Storage; -import com.google.cloud.storage.StorageException; -import java.io.InputStream; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import org.apache.nifi.flowfile.attributes.CoreAttributes; -import org.apache.nifi.util.MockFlowFile; -import org.apache.nifi.util.TestRunner; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.mockito.Mock; - /** * Unit tests for {@link PutGCSObject} which do not use Google Cloud resources. */ diff --git a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/StorageAttributesTest.java b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/StorageAttributesTest.java index 61ec9f50d0..e86407353e 100644 --- a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/StorageAttributesTest.java +++ b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/StorageAttributesTest.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.processors.gcp.storage; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.lang.reflect.Constructor; import java.lang.reflect.Modifier; diff --git a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/UtilTest.java b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/UtilTest.java index 0b2287d2d9..14279ad0dd 100644 --- a/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/UtilTest.java +++ b/nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/test/java/org/apache/nifi/processors/gcp/storage/UtilTest.java @@ -16,7 +16,7 @@ */ package org.apache.nifi.processors.gcp.storage; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; diff --git a/nifi-nar-bundles/nifi-grpc-bundle/nifi-grpc-processors/src/test/java/org/apache/nifi/processors/grpc/ITListenGRPC.java b/nifi-nar-bundles/nifi-grpc-bundle/nifi-grpc-processors/src/test/java/org/apache/nifi/processors/grpc/ITListenGRPC.java index eb5fb9748b..abeacb281f 100644 --- a/nifi-nar-bundles/nifi-grpc-bundle/nifi-grpc-processors/src/test/java/org/apache/nifi/processors/grpc/ITListenGRPC.java +++ b/nifi-nar-bundles/nifi-grpc-bundle/nifi-grpc-processors/src/test/java/org/apache/nifi/processors/grpc/ITListenGRPC.java @@ -25,13 +25,14 @@ import org.apache.nifi.processor.ProcessSessionFactory; import org.apache.nifi.util.MockFlowFile; import org.apache.nifi.util.TestRunner; import org.apache.nifi.util.TestRunners; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.List; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.StringContains.containsString; +import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @@ -119,49 +120,51 @@ public class ITListenGRPC { } } - @Test(expected = io.grpc.StatusRuntimeException.class) - public void testExceedMaxMessageSize() throws Exception { - final int randPort = TestGRPCClient.randomPort(); - final ManagedChannel channel = TestGRPCClient.buildChannel(HOST, randPort); - final FlowFileServiceGrpc.FlowFileServiceBlockingStub stub = FlowFileServiceGrpc.newBlockingStub(channel); + @Test + public void testExceedMaxMessageSize() { + assertThrows(io.grpc.StatusRuntimeException.class, () -> { + final int randPort = TestGRPCClient.randomPort(); + final ManagedChannel channel = TestGRPCClient.buildChannel(HOST, randPort); + final FlowFileServiceGrpc.FlowFileServiceBlockingStub stub = FlowFileServiceGrpc.newBlockingStub(channel); - final ListenGRPC listenGRPC = new ListenGRPC(); - final TestRunner runner = TestRunners.newTestRunner(listenGRPC); - runner.setProperty(ListenGRPC.PROP_SERVICE_PORT, String.valueOf(randPort)); - // set max message size to 1 byte to force exception to be thrown. - runner.setProperty(ListenGRPC.PROP_MAX_MESSAGE_SIZE, "1B"); + final ListenGRPC listenGRPC = new ListenGRPC(); + final TestRunner runner = TestRunners.newTestRunner(listenGRPC); + runner.setProperty(ListenGRPC.PROP_SERVICE_PORT, String.valueOf(randPort)); + // set max message size to 1 byte to force exception to be thrown. + runner.setProperty(ListenGRPC.PROP_MAX_MESSAGE_SIZE, "1B"); - final ProcessContext processContext = runner.getProcessContext(); - final ProcessSessionFactory processSessionFactory = runner.getProcessSessionFactory(); + final ProcessContext processContext = runner.getProcessContext(); + final ProcessSessionFactory processSessionFactory = runner.getProcessSessionFactory(); - try { - // start the server. The order of the following statements shouldn't matter, because the - // startServer() method waits for a processSessionFactory to be available to it. - listenGRPC.startServer(processContext); - listenGRPC.onTrigger(processContext, processSessionFactory); + try { + // start the server. The order of the following statements shouldn't matter, because the + // startServer() method waits for a processSessionFactory to be available to it. + listenGRPC.startServer(processContext); + listenGRPC.onTrigger(processContext, processSessionFactory); - final FlowFileRequest ingestFile = FlowFileRequest.newBuilder() - .putAttributes("FOO", "BAR") - .putAttributes(CoreAttributes.UUID.key(), SOURCE_SYSTEM_UUID) - .setContent(ByteString.copyFrom("content".getBytes())) - .build(); - // this should throw a runtime exception - final FlowFileReply reply = stub.send(ingestFile); - assertThat(reply.getResponseCode(), equalTo(FlowFileReply.ResponseCode.SUCCESS)); - assertThat(reply.getBody(), equalTo("FlowFile successfully received.")); + final FlowFileRequest ingestFile = FlowFileRequest.newBuilder() + .putAttributes("FOO", "BAR") + .putAttributes(CoreAttributes.UUID.key(), SOURCE_SYSTEM_UUID) + .setContent(ByteString.copyFrom("content".getBytes())) + .build(); + // this should throw a runtime exception + final FlowFileReply reply = stub.send(ingestFile); + assertThat(reply.getResponseCode(), equalTo(FlowFileReply.ResponseCode.SUCCESS)); + assertThat(reply.getBody(), equalTo("FlowFile successfully received.")); - runner.assertTransferCount(ListenGRPC.REL_SUCCESS, 1); - final List successFiles = runner.getFlowFilesForRelationship(ListenGRPC.REL_SUCCESS); - assertThat(successFiles.size(), equalTo(1)); - final MockFlowFile mockFlowFile = successFiles.get(0); - assertThat(mockFlowFile.getAttribute("FOO"), equalTo("BAR")); - assertThat(mockFlowFile.getAttribute(ListenGRPC.REMOTE_HOST), equalTo("127.0.0.1")); - assertThat(mockFlowFile.getAttribute(ListenGRPC.REMOTE_USER_DN), equalTo(FlowFileIngestServiceInterceptor.DEFAULT_FOUND_SUBJECT)); + runner.assertTransferCount(ListenGRPC.REL_SUCCESS, 1); + final List successFiles = runner.getFlowFilesForRelationship(ListenGRPC.REL_SUCCESS); + assertThat(successFiles.size(), equalTo(1)); + final MockFlowFile mockFlowFile = successFiles.get(0); + assertThat(mockFlowFile.getAttribute("FOO"), equalTo("BAR")); + assertThat(mockFlowFile.getAttribute(ListenGRPC.REMOTE_HOST), equalTo("127.0.0.1")); + assertThat(mockFlowFile.getAttribute(ListenGRPC.REMOTE_USER_DN), equalTo(FlowFileIngestServiceInterceptor.DEFAULT_FOUND_SUBJECT)); - } finally { - // stop the server - listenGRPC.stopServer(processContext); - channel.shutdown(); - } + } finally { + // stop the server + listenGRPC.stopServer(processContext); + channel.shutdown(); + } + }); } -} +} \ No newline at end of file diff --git a/nifi-nar-bundles/nifi-grpc-bundle/nifi-grpc-processors/src/test/java/org/apache/nifi/processors/grpc/TestInvokeGRPC.java b/nifi-nar-bundles/nifi-grpc-bundle/nifi-grpc-processors/src/test/java/org/apache/nifi/processors/grpc/TestInvokeGRPC.java index a1a2726819..be05a2ca2c 100644 --- a/nifi-nar-bundles/nifi-grpc-bundle/nifi-grpc-processors/src/test/java/org/apache/nifi/processors/grpc/TestInvokeGRPC.java +++ b/nifi-nar-bundles/nifi-grpc-bundle/nifi-grpc-processors/src/test/java/org/apache/nifi/processors/grpc/TestInvokeGRPC.java @@ -16,15 +16,14 @@ */ package org.apache.nifi.processors.grpc; +import io.grpc.stub.StreamObserver; import org.apache.nifi.util.MockFlowFile; import org.apache.nifi.util.TestRunner; import org.apache.nifi.util.TestRunners; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.List; -import io.grpc.stub.StreamObserver; - import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat;