You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ex...@apache.org on 2025/01/17 18:54:35 UTC
(nifi) branch main updated: NIFI-14153 Applied PMD SimplifiableTestAssertion and Fixed Violations (#9641)
This is an automated email from the ASF dual-hosted git repository.
exceptionfactory pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/main by this push:
new 4ae0a47901 NIFI-14153 Applied PMD SimplifiableTestAssertion and Fixed Violations (#9641)
4ae0a47901 is described below
commit 4ae0a47901142d91db513e9cd39bfe5b66bf5b94
Author: dan-s1 <ds...@gmail.com>
AuthorDate: Fri Jan 17 13:54:29 2025 -0500
NIFI-14153 Applied PMD SimplifiableTestAssertion and Fixed Violations (#9641)
Signed-off-by: David Handermann <ex...@apache.org>
---
.../attribute/expression/language/TestQuery.java | 5 ++-
.../org/apache/nifi/hl7/query/TestHL7Query.java | 3 +-
.../nifi/serialization/record/TestMapRecord.java | 7 ++--
.../repository/schema/TestSchemaRecordReader.java | 6 +--
.../schema/TestSchemaRecordReaderWriter.java | 8 ++--
.../nifi/stream/io/util/StreamDemarcatorTest.java | 48 +++++++++++-----------
.../file/classloader/TestClassLoaderUtils.java | 11 +++--
.../nifi/processors/aws/dynamodb/ItemKeysTest.java | 4 +-
.../processors/evtx/XmlBxmlNodeVisitorTest.java | 4 +-
.../processors/evtx/parser/ChunkHeaderTest.java | 3 +-
.../nifi/processors/evtx/parser/RecordTest.java | 4 +-
.../evtx/parser/bxml/AttributeNodeTest.java | 6 +--
.../evtx/parser/bxml/OpenStartElementNodeTest.java | 3 +-
.../processors/evtx/parser/bxml/RootNodeTest.java | 4 +-
.../processors/evtx/parser/bxml/ValueNodeTest.java | 4 +-
.../evtx/parser/bxml/value/BXmlTypeNodeTest.java | 4 +-
.../org/apache/nifi/util/db/TestJdbcCommon.java | 7 ++--
.../util/pattern/TestExceptionHandler.java | 4 +-
.../org/apache/nifi/avro/TestAvroTypeUtil.java | 40 +++++++++---------
.../schema/access/InferenceSchemaStrategyTest.java | 4 +-
.../ExternalHazelcastCacheManagerTest.java | 4 +-
.../jms/processors/JMSPublisherConsumerIT.java | 7 ++--
.../apache/nifi/jms/processors/PublishJMSIT.java | 31 +++++++-------
.../api/processor/TestProcessorResource.java | 3 +-
.../api/processor/TestProcessorWebUtils.java | 4 +-
.../processors/PublishKafkaValueRecordIT.java | 4 +-
.../additional/PublishKafkaContentX1IT.java | 3 +-
.../additional/PublishKafkaWrapperX1IT.java | 3 +-
.../additional/PublishKafkaWrapperX2IT.java | 3 +-
.../additional/PublishKafkaWrapperX3IT.java | 3 +-
.../additional/PublishKafkaWrapperX4IT.java | 3 +-
.../additional/PublishKafkaWrapperX5IT.java | 3 +-
.../apache/nifi/processors/mongodb/GetMongoIT.java | 3 +-
.../processors/mongodb/RunMongoAggregationIT.java | 2 +-
.../nifi/mongodb/MongoDBLookupServiceIT.java | 8 ++--
.../processors/standard/TestExecuteSQLRecord.java | 8 ++--
.../nifi/processors/standard/TestFetchFile.java | 10 ++---
.../nifi/processors/standard/TestFlattenJson.java | 3 +-
.../processors/standard/TestGenerateRecord.java | 10 +++--
.../nifi/processors/standard/TestNotify.java | 3 +-
.../nifi/processors/standard/TestReplaceText.java | 2 +-
.../nifi/processors/standard/TestSplitRecord.java | 3 +-
.../TestInsertRecordFieldsJoinStrategy.java | 3 +-
.../nifi/dbcp/TestDBCPConnectionPoolLookup.java | 6 +--
.../record/sink/db/DatabaseRecordSinkTest.java | 9 ++--
.../org/apache/nifi/avro/TestWriteAvroResult.java | 8 ++--
.../java/org/apache/nifi/cef/TestCEFReader.java | 15 ++++---
.../nifi/json/TestJsonPathRowRecordReader.java | 14 +++----
.../TestWindowsEventLogRecordReader.java | 32 +++++++--------
.../org/apache/nifi/xml/TestInferXmlSchema.java | 4 +-
.../nifi/yaml/TestYamlTreeRowRecordReader.java | 21 ++++++----
.../nifi/authorization/AuthorizerFactoryTest.java | 8 ++--
.../StandardManagedAuthorizerTest.java | 5 +--
.../jaxb/message/TestJaxbProtocolUtils.java | 13 +++---
.../node/TestNodeClusterCoordinator.java | 19 +++++----
...StandardControllerServiceInvocationHandler.java | 5 ++-
.../apache/nifi/nar/LoadNativeLibAspectTest.java | 3 +-
.../http/TestHttpFlowFileServerProtocol.java | 3 +-
.../StandardAuthorizableLookupTest.java | 24 +++++------
.../nifi/web/api/TestDataTransferResource.java | 4 +-
.../org/apache/nifi/web/api/TestFlowResource.java | 11 ++---
.../serialization/TestFlowContentSerializer.java | 2 +-
.../nifi/registry/service/TestRegistryService.java | 2 +-
.../apache/nifi/registry/web/api/BucketsIT.java | 3 +-
.../web/api/SecureNiFiRegistryClientIT.java | 12 +++---
.../stateless/basics/RollbackOnExceptionIT.java | 6 +--
pmd-ruleset.xml | 1 +
67 files changed, 284 insertions(+), 251 deletions(-)
diff --git a/nifi-commons/nifi-expression-language/src/test/java/org/apache/nifi/attribute/expression/language/TestQuery.java b/nifi-commons/nifi-expression-language/src/test/java/org/apache/nifi/attribute/expression/language/TestQuery.java
index 07115dab63..bf999e0d75 100644
--- a/nifi-commons/nifi-expression-language/src/test/java/org/apache/nifi/attribute/expression/language/TestQuery.java
+++ b/nifi-commons/nifi-expression-language/src/test/java/org/apache/nifi/attribute/expression/language/TestQuery.java
@@ -58,6 +58,7 @@ import static java.lang.Double.POSITIVE_INFINITY;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -2560,14 +2561,14 @@ public class TestQuery {
if (expectedResult instanceof Long) {
if (ResultType.NUMBER.equals(result.getResultType())) {
final Number resultNumber = ((NumberQueryResult) result).getValue();
- assertTrue(resultNumber instanceof Long);
+ assertInstanceOf(Long.class, resultNumber);
} else {
assertEquals(ResultType.WHOLE_NUMBER, result.getResultType());
}
} else if (expectedResult instanceof Double) {
if (ResultType.NUMBER.equals(result.getResultType())) {
final Number resultNumber = ((NumberQueryResult) result).getValue();
- assertTrue(resultNumber instanceof Double);
+ assertInstanceOf(Double.class, resultNumber);
} else {
assertEquals(ResultType.DECIMAL, result.getResultType());
}
diff --git a/nifi-commons/nifi-hl7-query-language/src/test/java/org/apache/nifi/hl7/query/TestHL7Query.java b/nifi-commons/nifi-hl7-query-language/src/test/java/org/apache/nifi/hl7/query/TestHL7Query.java
index ce944e6b9f..6cccbdb45b 100644
--- a/nifi-commons/nifi-hl7-query-language/src/test/java/org/apache/nifi/hl7/query/TestHL7Query.java
+++ b/nifi-commons/nifi-hl7-query-language/src/test/java/org/apache/nifi/hl7/query/TestHL7Query.java
@@ -35,6 +35,7 @@ import java.util.Map;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertTrue;
@SuppressWarnings("resource")
@@ -136,7 +137,7 @@ public class TestHL7Query {
assertEquals(1, result.getHitCount());
final Object names = result.nextHit().getValue("PID.5");
- assertTrue(names instanceof List);
+ assertInstanceOf(List.class, names);
final List<Object> nameList = (List) names;
assertEquals(1, nameList.size());
final HL7Field nameField = (HL7Field) nameList.get(0);
diff --git a/nifi-commons/nifi-record/src/test/java/org/apache/nifi/serialization/record/TestMapRecord.java b/nifi-commons/nifi-record/src/test/java/org/apache/nifi/serialization/record/TestMapRecord.java
index 02f0a3100d..928e1c9965 100644
--- a/nifi-commons/nifi-record/src/test/java/org/apache/nifi/serialization/record/TestMapRecord.java
+++ b/nifi-commons/nifi-record/src/test/java/org/apache/nifi/serialization/record/TestMapRecord.java
@@ -42,6 +42,7 @@ import java.util.stream.Stream;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertThrows;
@@ -315,17 +316,17 @@ class TestMapRecord {
Map<String, Object> fullConversion = ((MapRecord) record).toMap(true);
assertEquals(FOO_TEST_VAL, fullConversion.get("foo"));
- assertTrue(fullConversion.get("nested") instanceof Map);
+ assertInstanceOf(Map.class, fullConversion.get("nested"));
Map<String, Object> nested = (Map<String, Object>) fullConversion.get("nested");
assertEquals(1, nested.size());
assertEquals(NESTED_RECORD_VALUE, nested.get("test"));
- assertTrue(fullConversion.get("list") instanceof List);
+ assertInstanceOf(List.class, fullConversion.get("list"));
List recordList = (List) fullConversion.get("list");
assertEquals(5, recordList.size());
for (Object rec : recordList) {
- assertTrue(rec instanceof Map);
+ assertInstanceOf(Map.class, rec);
Map<String, Object> map = (Map<String, Object>) rec;
assertEquals(1, map.size());
assertEquals(NESTED_RECORD_VALUE, map.get("test"));
diff --git a/nifi-commons/nifi-schema-utils/src/test/java/org/apache/nifi/repository/schema/TestSchemaRecordReader.java b/nifi-commons/nifi-schema-utils/src/test/java/org/apache/nifi/repository/schema/TestSchemaRecordReader.java
index 497e5c9843..d51dc4fd53 100644
--- a/nifi-commons/nifi-schema-utils/src/test/java/org/apache/nifi/repository/schema/TestSchemaRecordReader.java
+++ b/nifi-commons/nifi-schema-utils/src/test/java/org/apache/nifi/repository/schema/TestSchemaRecordReader.java
@@ -25,11 +25,11 @@ import java.io.DataOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
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.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -109,7 +109,7 @@ public class TestSchemaRecordReader {
assertEquals(42, record.getFieldValue("int"));
assertTrue((boolean) record.getFieldValue("boolean"));
- assertTrue(Arrays.equals("hello".getBytes(), (byte[]) record.getFieldValue("byte array")));
+ assertArrayEquals("hello".getBytes(), (byte[]) record.getFieldValue("byte array"));
assertEquals(42L, record.getFieldValue("long"));
assertEquals("hello", record.getFieldValue("string"));
assertEquals("hello", record.getFieldValue("long string"));
@@ -251,7 +251,7 @@ public class TestSchemaRecordReader {
assertEquals(42, valueMap.get("int present"));
assertTrue((boolean) valueMap.get("boolean present"));
- assertTrue(Arrays.equals("hello".getBytes(), (byte[]) valueMap.get("byte array present")));
+ assertArrayEquals("hello".getBytes(), (byte[]) valueMap.get("byte array present"));
assertEquals(42L, valueMap.get("long present"));
assertEquals("hello", valueMap.get("string present"));
assertEquals("hello", valueMap.get("long string present"));
diff --git a/nifi-commons/nifi-schema-utils/src/test/java/org/apache/nifi/repository/schema/TestSchemaRecordReaderWriter.java b/nifi-commons/nifi-schema-utils/src/test/java/org/apache/nifi/repository/schema/TestSchemaRecordReaderWriter.java
index 52b7461a20..92ab6034ac 100644
--- a/nifi-commons/nifi-schema-utils/src/test/java/org/apache/nifi/repository/schema/TestSchemaRecordReaderWriter.java
+++ b/nifi-commons/nifi-schema-utils/src/test/java/org/apache/nifi/repository/schema/TestSchemaRecordReaderWriter.java
@@ -26,13 +26,13 @@ import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import static org.apache.nifi.repository.schema.SchemaRecordWriter.MAX_ALLOWED_UTF_LENGTH;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
@@ -152,7 +152,7 @@ public class TestSchemaRecordReaderWriter {
assertEquals(42, record.getFieldValue("int"));
assertEquals(42, record.getFieldValue("int present"));
assertEquals(true, record.getFieldValue("boolean present"));
- assertTrue(Arrays.equals("Hello".getBytes(), (byte[]) record.getFieldValue("byte array present")));
+ assertArrayEquals("Hello".getBytes(), (byte[]) record.getFieldValue("byte array present"));
assertEquals(42L, record.getFieldValue("long present"));
assertEquals("Hello", record.getFieldValue("string present"));
assertEquals("Long Hello", record.getFieldValue("long string present"));
@@ -197,8 +197,8 @@ public class TestSchemaRecordReaderWriter {
values.put(createField("int present", FieldType.INT), 42);
final String utfString = utfStringOneByte + utfStringTwoByte + utfStringThreeByte; // 3 chars and 6 utf8 bytes
final String seventyK = StringUtils.repeat(utfString, 21845); // 65,535 chars and 131070 utf8 bytes
- assertTrue(seventyK.length() == 65535);
- assertTrue(seventyK.getBytes(StandardCharsets.UTF_8).length == 131070);
+ assertEquals(65535, seventyK.length());
+ assertEquals(131070, seventyK.getBytes(StandardCharsets.UTF_8).length);
values.put(createField("string present", FieldType.STRING), seventyK);
final FieldMapRecord originalRecord = new FieldMapRecord(values, schema);
diff --git a/nifi-commons/nifi-utils/src/test/java/org/apache/nifi/stream/io/util/StreamDemarcatorTest.java b/nifi-commons/nifi-utils/src/test/java/org/apache/nifi/stream/io/util/StreamDemarcatorTest.java
index 1397fda01a..d9f1805943 100644
--- a/nifi-commons/nifi-utils/src/test/java/org/apache/nifi/stream/io/util/StreamDemarcatorTest.java
+++ b/nifi-commons/nifi-utils/src/test/java/org/apache/nifi/stream/io/util/StreamDemarcatorTest.java
@@ -22,14 +22,12 @@ import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
-import java.util.Arrays;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;
@@ -86,7 +84,7 @@ public class StreamDemarcatorTest {
String data = "Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning.";
ByteArrayInputStream is = new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8));
StreamDemarcator scanner = new StreamDemarcator(is, null, 1000);
- assertTrue(Arrays.equals(data.getBytes(StandardCharsets.UTF_8), scanner.nextToken()));
+ assertArrayEquals(data.getBytes(StandardCharsets.UTF_8), scanner.nextToken());
// validate that subsequent invocations of nextToken() do not result in exception
assertNull(scanner.nextToken());
assertNull(scanner.nextToken());
@@ -97,7 +95,7 @@ public class StreamDemarcatorTest {
String data = "Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning.";
ByteArrayInputStream is = new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8));
StreamDemarcator scanner = new StreamDemarcator(is, null, 1000, 1);
- assertTrue(Arrays.equals(data.getBytes(StandardCharsets.UTF_8), scanner.nextToken()));
+ assertArrayEquals(data.getBytes(StandardCharsets.UTF_8), scanner.nextToken());
}
@Test
@@ -105,9 +103,9 @@ public class StreamDemarcatorTest {
String data = "Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning.";
ByteArrayInputStream is = new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8));
StreamDemarcator scanner = new StreamDemarcator(is, ",".getBytes(StandardCharsets.UTF_8), 1000);
- assertTrue(Arrays.equals("Learn from yesterday".getBytes(StandardCharsets.UTF_8), scanner.nextToken()));
- assertTrue(Arrays.equals(" live for today".getBytes(StandardCharsets.UTF_8), scanner.nextToken()));
- assertTrue(Arrays.equals(" hope for tomorrow. The important thing is not to stop questioning.".getBytes(StandardCharsets.UTF_8), scanner.nextToken()));
+ assertArrayEquals("Learn from yesterday".getBytes(StandardCharsets.UTF_8), scanner.nextToken());
+ assertArrayEquals(" live for today".getBytes(StandardCharsets.UTF_8), scanner.nextToken());
+ assertArrayEquals(" hope for tomorrow. The important thing is not to stop questioning.".getBytes(StandardCharsets.UTF_8), scanner.nextToken());
assertNull(scanner.nextToken());
}
@@ -116,9 +114,9 @@ public class StreamDemarcatorTest {
String data = ",Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning.";
ByteArrayInputStream is = new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8));
StreamDemarcator scanner = new StreamDemarcator(is, ",".getBytes(StandardCharsets.UTF_8), 1000);
- assertTrue(Arrays.equals("Learn from yesterday".getBytes(StandardCharsets.UTF_8), scanner.nextToken()));
- assertTrue(Arrays.equals(" live for today".getBytes(StandardCharsets.UTF_8), scanner.nextToken()));
- assertTrue(Arrays.equals(" hope for tomorrow. The important thing is not to stop questioning.".getBytes(StandardCharsets.UTF_8), scanner.nextToken()));
+ assertArrayEquals("Learn from yesterday".getBytes(StandardCharsets.UTF_8), scanner.nextToken());
+ assertArrayEquals(" live for today".getBytes(StandardCharsets.UTF_8), scanner.nextToken());
+ assertArrayEquals(" hope for tomorrow. The important thing is not to stop questioning.".getBytes(StandardCharsets.UTF_8), scanner.nextToken());
assertNull(scanner.nextToken());
}
@@ -127,9 +125,9 @@ public class StreamDemarcatorTest {
String data = ",,,,,Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning.";
ByteArrayInputStream is = new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8));
StreamDemarcator scanner = new StreamDemarcator(is, ",".getBytes(StandardCharsets.UTF_8), 1000);
- assertTrue(Arrays.equals("Learn from yesterday".getBytes(StandardCharsets.UTF_8), scanner.nextToken()));
- assertTrue(Arrays.equals(" live for today".getBytes(StandardCharsets.UTF_8), scanner.nextToken()));
- assertTrue(Arrays.equals(" hope for tomorrow. The important thing is not to stop questioning.".getBytes(StandardCharsets.UTF_8), scanner.nextToken()));
+ assertArrayEquals("Learn from yesterday".getBytes(StandardCharsets.UTF_8), scanner.nextToken());
+ assertArrayEquals(" live for today".getBytes(StandardCharsets.UTF_8), scanner.nextToken());
+ assertArrayEquals(" hope for tomorrow. The important thing is not to stop questioning.".getBytes(StandardCharsets.UTF_8), scanner.nextToken());
assertNull(scanner.nextToken());
}
@@ -138,9 +136,9 @@ public class StreamDemarcatorTest {
String data = "Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning.";
ByteArrayInputStream is = new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8));
StreamDemarcator scanner = new StreamDemarcator(is, ",".getBytes(StandardCharsets.UTF_8), 1000, 2);
- assertTrue(Arrays.equals("Learn from yesterday".getBytes(StandardCharsets.UTF_8), scanner.nextToken()));
- assertTrue(Arrays.equals(" live for today".getBytes(StandardCharsets.UTF_8), scanner.nextToken()));
- assertTrue(Arrays.equals(" hope for tomorrow. The important thing is not to stop questioning.".getBytes(StandardCharsets.UTF_8), scanner.nextToken()));
+ assertArrayEquals("Learn from yesterday".getBytes(StandardCharsets.UTF_8), scanner.nextToken());
+ assertArrayEquals(" live for today".getBytes(StandardCharsets.UTF_8), scanner.nextToken());
+ assertArrayEquals(" hope for tomorrow. The important thing is not to stop questioning.".getBytes(StandardCharsets.UTF_8), scanner.nextToken());
assertNull(scanner.nextToken());
}
@@ -149,9 +147,9 @@ public class StreamDemarcatorTest {
String data = "foodaabardaabazzz";
ByteArrayInputStream is = new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8));
StreamDemarcator scanner = new StreamDemarcator(is, "daa".getBytes(StandardCharsets.UTF_8), 1000);
- assertTrue(Arrays.equals("foo".getBytes(StandardCharsets.UTF_8), scanner.nextToken()));
- assertTrue(Arrays.equals("bar".getBytes(StandardCharsets.UTF_8), scanner.nextToken()));
- assertTrue(Arrays.equals("bazzz".getBytes(StandardCharsets.UTF_8), scanner.nextToken()));
+ assertArrayEquals("foo".getBytes(StandardCharsets.UTF_8), scanner.nextToken());
+ assertArrayEquals("bar".getBytes(StandardCharsets.UTF_8), scanner.nextToken());
+ assertArrayEquals("bazzz".getBytes(StandardCharsets.UTF_8), scanner.nextToken());
assertNull(scanner.nextToken());
}
@@ -160,9 +158,9 @@ public class StreamDemarcatorTest {
String data = "daafoodaabardaabazzz";
ByteArrayInputStream is = new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8));
StreamDemarcator scanner = new StreamDemarcator(is, "daa".getBytes(StandardCharsets.UTF_8), 1000);
- assertTrue(Arrays.equals("foo".getBytes(StandardCharsets.UTF_8), scanner.nextToken()));
- assertTrue(Arrays.equals("bar".getBytes(StandardCharsets.UTF_8), scanner.nextToken()));
- assertTrue(Arrays.equals("bazzz".getBytes(StandardCharsets.UTF_8), scanner.nextToken()));
+ assertArrayEquals("foo".getBytes(StandardCharsets.UTF_8), scanner.nextToken());
+ assertArrayEquals("bar".getBytes(StandardCharsets.UTF_8), scanner.nextToken());
+ assertArrayEquals("bazzz".getBytes(StandardCharsets.UTF_8), scanner.nextToken());
assertNull(scanner.nextToken());
}
@@ -171,9 +169,9 @@ public class StreamDemarcatorTest {
String data = "foodaabarffdaabazz";
ByteArrayInputStream is = new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8));
StreamDemarcator scanner = new StreamDemarcator(is, "daa".getBytes(StandardCharsets.UTF_8), 1000, 1);
- assertTrue(Arrays.equals("foo".getBytes(StandardCharsets.UTF_8), scanner.nextToken()));
- assertTrue(Arrays.equals("barff".getBytes(StandardCharsets.UTF_8), scanner.nextToken()));
- assertTrue(Arrays.equals("bazz".getBytes(StandardCharsets.UTF_8), scanner.nextToken()));
+ assertArrayEquals("foo".getBytes(StandardCharsets.UTF_8), scanner.nextToken());
+ assertArrayEquals("barff".getBytes(StandardCharsets.UTF_8), scanner.nextToken());
+ assertArrayEquals("bazz".getBytes(StandardCharsets.UTF_8), scanner.nextToken());
assertNull(scanner.nextToken());
}
diff --git a/nifi-commons/nifi-utils/src/test/java/org/apache/nifi/util/file/classloader/TestClassLoaderUtils.java b/nifi-commons/nifi-utils/src/test/java/org/apache/nifi/util/file/classloader/TestClassLoaderUtils.java
index 5c11257411..4b267058d8 100644
--- a/nifi-commons/nifi-utils/src/test/java/org/apache/nifi/util/file/classloader/TestClassLoaderUtils.java
+++ b/nifi-commons/nifi-utils/src/test/java/org/apache/nifi/util/file/classloader/TestClassLoaderUtils.java
@@ -29,7 +29,6 @@ import java.util.Set;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.junit.jupiter.api.Assertions.assertTrue;
public class TestClassLoaderUtils {
@@ -37,17 +36,17 @@ public class TestClassLoaderUtils {
public void testGetCustomClassLoader() throws MalformedURLException, ClassNotFoundException {
final String jarFilePath = "src/test/resources/TestClassLoaderUtils";
ClassLoader customClassLoader = ClassLoaderUtils.getCustomClassLoader(jarFilePath, this.getClass().getClassLoader(), getJarFilenameFilter());
- assertTrue(customClassLoader != null);
- assertTrue(customClassLoader.loadClass("TestSuccess") != null);
+ assertNotNull(customClassLoader);
+ assertNotNull(customClassLoader.loadClass("TestSuccess"));
}
@Test
public void testGetCustomClassLoaderNoPathSpecified() throws MalformedURLException {
final ClassLoader originalClassLoader = this.getClass().getClassLoader();
ClassLoader customClassLoader = ClassLoaderUtils.getCustomClassLoader(null, originalClassLoader, getJarFilenameFilter());
- assertTrue(customClassLoader != null);
+ assertNotNull(customClassLoader);
ClassNotFoundException cex = assertThrows(ClassNotFoundException.class, () -> customClassLoader.loadClass("TestSuccess"));
- assertTrue(cex.getLocalizedMessage().equals("TestSuccess"));
+ assertEquals("TestSuccess", cex.getLocalizedMessage());
}
@Test
@@ -55,7 +54,7 @@ public class TestClassLoaderUtils {
final String jarFilePath = "src/test/resources/FakeTestClassLoaderUtils/TestSuccess.jar";
MalformedURLException mex = assertThrows(MalformedURLException.class,
() -> ClassLoaderUtils.getCustomClassLoader(jarFilePath, this.getClass().getClassLoader(), getJarFilenameFilter()));
- assertTrue(mex.getLocalizedMessage().equals("Path specified does not exist"));
+ assertEquals("Path specified does not exist", mex.getLocalizedMessage());
}
@Test
diff --git a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/dynamodb/ItemKeysTest.java b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/dynamodb/ItemKeysTest.java
index b26273cfb7..e31cf2abb2 100644
--- a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/dynamodb/ItemKeysTest.java
+++ b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/dynamodb/ItemKeysTest.java
@@ -20,7 +20,7 @@ import org.junit.jupiter.api.Test;
import software.amazon.awssdk.services.dynamodb.model.AttributeValue;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
public class ItemKeysTest {
@@ -64,7 +64,7 @@ public class ItemKeysTest {
public void testHashNotNullRangeNotNullForOtherNotEquals() {
ItemKeys ik1 = new ItemKeys(null, string("ab"));
ItemKeys ik2 = new ItemKeys(string("ab"), null);
- assertFalse(ik1.equals(ik2));
+ assertNotEquals(ik1, ik2);
}
private static AttributeValue string(final String s) {
diff --git a/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/XmlBxmlNodeVisitorTest.java b/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/XmlBxmlNodeVisitorTest.java
index 67c3c033e6..41ca0d59bd 100644
--- a/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/XmlBxmlNodeVisitorTest.java
+++ b/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/XmlBxmlNodeVisitorTest.java
@@ -46,8 +46,8 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.any;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.inOrder;
@@ -319,7 +319,7 @@ public class XmlBxmlNodeVisitorTest {
verify(child).accept(captor.capture());
BxmlNodeVisitor value = captor.getValue();
- assertTrue(value instanceof XmlBxmlNodeVisitor);
+ assertInstanceOf(XmlBxmlNodeVisitor.class, value);
assertNotEquals(xmlBxmlNodeVisitor, value);
}
}
diff --git a/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/ChunkHeaderTest.java b/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/ChunkHeaderTest.java
index 7376852445..5d34cdf395 100644
--- a/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/ChunkHeaderTest.java
+++ b/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/ChunkHeaderTest.java
@@ -41,6 +41,7 @@ import java.util.zip.CRC32;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;
@@ -137,7 +138,7 @@ public class ChunkHeaderTest {
RootNode rootNode = next.getRootNode();
List<BxmlNode> children = rootNode.getChildren();
assertEquals(1, children.size());
- assertTrue(children.get(0) instanceof EndOfStreamNode);
+ assertInstanceOf(EndOfStreamNode.class, children.get(0));
assertEquals(0, rootNode.getSubstitutions().size());
assertFalse(chunkHeader.hasNext());
diff --git a/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/RecordTest.java b/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/RecordTest.java
index e03ea2022f..9f1de61fe4 100644
--- a/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/RecordTest.java
+++ b/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/RecordTest.java
@@ -31,7 +31,7 @@ import java.util.Date;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
@ExtendWith(MockitoExtension.class)
public class RecordTest {
@@ -67,7 +67,7 @@ public class RecordTest {
RootNode rootNode = record.getRootNode();
List<BxmlNode> children = rootNode.getChildren();
assertEquals(1, children.size());
- assertTrue(children.get(0) instanceof EndOfStreamNode);
+ assertInstanceOf(EndOfStreamNode.class, children.get(0));
assertEquals(0, rootNode.getSubstitutions().size());
}
}
diff --git a/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/AttributeNodeTest.java b/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/AttributeNodeTest.java
index ae5137e0f2..8876c671f6 100644
--- a/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/AttributeNodeTest.java
+++ b/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/AttributeNodeTest.java
@@ -26,7 +26,7 @@ import java.io.IOException;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
@@ -58,10 +58,10 @@ public class AttributeNodeTest extends BxmlNodeWithTokenAndStringTestBase {
public void testInit() {
assertEquals(ATTRIBUTE_NAME, attributeNode.getAttributeName());
BxmlNode attributeNodeValue = attributeNode.getValue();
- assertTrue(attributeNodeValue instanceof ValueNode);
+ assertInstanceOf(ValueNode.class, attributeNodeValue);
List<BxmlNode> children = ((ValueNode) attributeNodeValue).getChildren();
assertEquals(1, children.size());
- assertTrue(children.get(0) instanceof NullTypeNode);
+ assertInstanceOf(NullTypeNode.class, children.get(0));
}
@Test
diff --git a/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/OpenStartElementNodeTest.java b/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/OpenStartElementNodeTest.java
index 4d1337d211..894f538178 100644
--- a/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/OpenStartElementNodeTest.java
+++ b/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/OpenStartElementNodeTest.java
@@ -27,6 +27,7 @@ import java.io.IOException;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
@@ -58,7 +59,7 @@ public class OpenStartElementNodeTest extends BxmlNodeWithTokenTestBase {
assertEquals(tagName, openStartElementNode.getTagName());
List<BxmlNode> children = openStartElementNode.getChildren();
assertEquals(1, children.size());
- assertTrue(children.get(0) instanceof CloseEmptyElementNode);
+ assertInstanceOf(CloseEmptyElementNode.class, children.get(0));
}
@Test
diff --git a/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/RootNodeTest.java b/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/RootNodeTest.java
index f415402ded..020e705395 100644
--- a/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/RootNodeTest.java
+++ b/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/RootNodeTest.java
@@ -26,7 +26,7 @@ import java.io.IOException;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
@@ -55,7 +55,7 @@ public class RootNodeTest extends BxmlNodeTestBase {
public void testInit() {
List<BxmlNode> children = rootNode.getChildren();
assertEquals(1, children.size());
- assertTrue(children.get(0) instanceof EndOfStreamNode);
+ assertInstanceOf(EndOfStreamNode.class, children.get(0));
List<VariantTypeNode> substitutions = rootNode.getSubstitutions();
assertEquals(1, substitutions.size());
diff --git a/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/ValueNodeTest.java b/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/ValueNodeTest.java
index 7b15361fbc..2e8684ff6b 100644
--- a/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/ValueNodeTest.java
+++ b/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/ValueNodeTest.java
@@ -26,7 +26,7 @@ import java.io.IOException;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
@@ -52,7 +52,7 @@ public class ValueNodeTest extends BxmlNodeWithTokenTestBase {
assertEquals(getToken(), valueNode.getToken());
List<BxmlNode> children = valueNode.getChildren();
assertEquals(1, children.size());
- assertTrue(children.get(0) instanceof NullTypeNode);
+ assertInstanceOf(NullTypeNode.class, children.get(0));
}
@Test
diff --git a/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/BXmlTypeNodeTest.java b/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/BXmlTypeNodeTest.java
index d0a27c00c5..34a842034e 100644
--- a/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/BXmlTypeNodeTest.java
+++ b/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/test/java/org/apache/nifi/processors/evtx/parser/bxml/value/BXmlTypeNodeTest.java
@@ -28,7 +28,7 @@ import java.io.IOException;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
public class BXmlTypeNodeTest extends BxmlNodeTestBase {
private BXmlTypeNode bXmlTypeNode;
@@ -47,7 +47,7 @@ public class BXmlTypeNodeTest extends BxmlNodeTestBase {
RootNode rootNode = bXmlTypeNode.getRootNode();
List<BxmlNode> children = rootNode.getChildren();
assertEquals(1, children.size());
- assertTrue(children.get(0) instanceof EndOfStreamNode);
+ assertInstanceOf(EndOfStreamNode.class, children.get(0));
assertEquals(0, rootNode.getSubstitutions().size());
assertEquals(rootNode.toString(), bXmlTypeNode.getValue());
}
diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-database-utils/src/test/java/org/apache/nifi/util/db/TestJdbcCommon.java b/nifi-extension-bundles/nifi-extension-utils/nifi-database-utils/src/test/java/org/apache/nifi/util/db/TestJdbcCommon.java
index 19cdd334fe..ed154ef7e0 100644
--- a/nifi-extension-bundles/nifi-extension-utils/nifi-database-utils/src/test/java/org/apache/nifi/util/db/TestJdbcCommon.java
+++ b/nifi-extension-bundles/nifi-extension-utils/nifi-database-utils/src/test/java/org/apache/nifi/util/db/TestJdbcCommon.java
@@ -81,6 +81,7 @@ import org.slf4j.LoggerFactory;
import static org.apache.nifi.util.db.JdbcCommon.MASKED_LOG_VALUE;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
@@ -609,7 +610,7 @@ public class TestJdbcCommon {
assertNull(o);
} else {
assertNotNull(o);
- assertTrue(o instanceof ByteBuffer);
+ assertInstanceOf(ByteBuffer.class, o);
final byte[] blob = ((ByteBuffer) o).array();
assertEquals(4002, blob.length);
// Third byte should be 67 ('C')
@@ -647,7 +648,7 @@ public class TestJdbcCommon {
while (dataFileReader.hasNext()) {
record = dataFileReader.next(record);
Object o = record.get("t_clob");
- assertTrue(o instanceof Utf8);
+ assertInstanceOf(Utf8.class, o);
assertEquals("test clob", o.toString());
}
}
@@ -681,7 +682,7 @@ public class TestJdbcCommon {
while (dataFileReader.hasNext()) {
record = dataFileReader.next(record);
Object o = record.get("t_blob");
- assertTrue(o instanceof ByteBuffer);
+ assertInstanceOf(ByteBuffer.class, o);
ByteBuffer bb = (ByteBuffer) o;
assertEquals("test blob", new String(bb.array(), StandardCharsets.UTF_8));
}
diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-put-pattern/src/test/java/org/apache/nifi/processor/util/pattern/TestExceptionHandler.java b/nifi-extension-bundles/nifi-extension-utils/nifi-put-pattern/src/test/java/org/apache/nifi/processor/util/pattern/TestExceptionHandler.java
index a7ff33e5f0..fedf666bb9 100644
--- a/nifi-extension-bundles/nifi-extension-utils/nifi-put-pattern/src/test/java/org/apache/nifi/processor/util/pattern/TestExceptionHandler.java
+++ b/nifi-extension-bundles/nifi-extension-utils/nifi-put-pattern/src/test/java/org/apache/nifi/processor/util/pattern/TestExceptionHandler.java
@@ -29,8 +29,8 @@ import java.util.function.Function;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
public class TestExceptionHandler {
@@ -90,7 +90,7 @@ public class TestExceptionHandler {
final Integer nullInput = null;
ProcessException pe = assertThrows(ProcessException.class, () -> handler.execute(context, nullInput, i -> r.set(p.divide(i, 2))),
"Exception should be thrown because input is null.");
- assertTrue(pe.getCause() instanceof NullPointerException);
+ assertInstanceOf(NullPointerException.class, pe.getCause());
}
// Reusable Exception mapping function.
diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/test/java/org/apache/nifi/avro/TestAvroTypeUtil.java b/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/test/java/org/apache/nifi/avro/TestAvroTypeUtil.java
index d629518cae..dbc53dd147 100644
--- a/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/test/java/org/apache/nifi/avro/TestAvroTypeUtil.java
+++ b/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/test/java/org/apache/nifi/avro/TestAvroTypeUtil.java
@@ -63,8 +63,10 @@ import org.slf4j.LoggerFactory;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
@@ -221,7 +223,7 @@ public class TestAvroTypeUtil {
Optional<RecordField> uuidField = recordSchema.getField("uuid_test");
assertTrue(uuidField.isPresent());
RecordField field = uuidField.get();
- assertTrue(field.getDataType() == RecordFieldType.UUID.getDataType());
+ assertSame(field.getDataType(), RecordFieldType.UUID.getDataType());
}
@Test
@@ -307,7 +309,7 @@ public class TestAvroTypeUtil {
RecordSchema record = AvroTypeUtil.createSchema(avroSchema);
RecordField field = record.getField("listOfInt").get();
assertEquals(RecordFieldType.ARRAY, field.getDataType().getFieldType());
- assertTrue(field.getDefaultValue() instanceof Object[]);
+ assertInstanceOf(Object[].class, field.getDefaultValue());
assertEquals(1, ((Object[]) field.getDefaultValue()).length);
}
@@ -329,7 +331,7 @@ public class TestAvroTypeUtil {
RecordSchema record = AvroTypeUtil.createSchema(avroSchema);
RecordField field = record.getField("listOfInt").get();
assertEquals(RecordFieldType.ARRAY, field.getDataType().getFieldType());
- assertTrue(field.getDefaultValue() instanceof Object[]);
+ assertInstanceOf(Object[].class, field.getDefaultValue());
assertArrayEquals(new Object[] {1, 2}, ((Object[]) field.getDefaultValue()));
}
@@ -359,7 +361,7 @@ public class TestAvroTypeUtil {
RecordSchema childSchema = data.getChildSchema();
RecordField childField = childSchema.getField("listOfInt").get();
assertEquals(RecordFieldType.ARRAY, childField.getDataType().getFieldType());
- assertTrue(childField.getDefaultValue() instanceof Object[]);
+ assertInstanceOf(Object[].class, childField.getDefaultValue());
assertArrayEquals(new Object[] {0}, ((Object[]) childField.getDefaultValue()));
}
@@ -389,7 +391,7 @@ public class TestAvroTypeUtil {
RecordSchema childSchema = data.getChildSchema();
RecordField childField = childSchema.getField("listOfInt").get();
assertEquals(RecordFieldType.ARRAY, childField.getDataType().getFieldType());
- assertTrue(childField.getDefaultValue() instanceof Object[]);
+ assertInstanceOf(Object[].class, childField.getDefaultValue());
assertArrayEquals(new Object[] {1, 2, 3}, ((Object[]) childField.getDefaultValue()));
}
@Test
@@ -587,7 +589,7 @@ public class TestAvroTypeUtil {
return;
}
- assertTrue(convertedValue instanceof ByteBuffer);
+ assertInstanceOf(ByteBuffer.class, convertedValue);
final ByteBuffer serializedBytes = (ByteBuffer) convertedValue;
final BigDecimal bigDecimal = new Conversions.DecimalConversion().fromBytes(serializedBytes, fieldSchema,
@@ -652,7 +654,7 @@ public class TestAvroTypeUtil {
final Object resultObject = convertedMap.get("amount");
assertNotNull(resultObject);
- assertTrue(resultObject instanceof BigDecimal);
+ assertInstanceOf(BigDecimal.class, resultObject);
final BigDecimal resultBigDecimal = (BigDecimal) resultObject;
assertEquals(expectedBigDecimal, resultBigDecimal);
@@ -664,7 +666,7 @@ public class TestAvroTypeUtil {
final Schema fieldSchema = Schema.create(Type.BYTES);
decimalType.addToSchema(fieldSchema);
final Object convertedValue = AvroTypeUtil.convertToAvroObject("2.5", fieldSchema, StandardCharsets.UTF_8);
- assertTrue(convertedValue instanceof ByteBuffer);
+ assertInstanceOf(ByteBuffer.class, convertedValue);
final ByteBuffer serializedBytes = (ByteBuffer) convertedValue;
final BigDecimal bigDecimal = new Conversions.DecimalConversion().fromBytes(serializedBytes, fieldSchema, decimalType);
assertEquals(new BigDecimal("2.5").setScale(8), bigDecimal);
@@ -678,7 +680,7 @@ public class TestAvroTypeUtil {
final Schema fieldSchema = Schema.create(Type.INT);
dateType.addToSchema(fieldSchema);
final Object convertedValue = AvroTypeUtil.convertToAvroObject(Date.valueOf(date), fieldSchema);
- assertTrue(convertedValue instanceof Integer);
+ assertInstanceOf(Integer.class, convertedValue);
final int epochDay = (int) LocalDate.parse(date).toEpochDay();
assertEquals(epochDay, convertedValue);
}
@@ -689,7 +691,7 @@ public class TestAvroTypeUtil {
final Schema fieldSchema = Schema.createFixed("mydecimal", "no doc", "myspace", 18);
decimalType.addToSchema(fieldSchema);
final Object convertedValue = AvroTypeUtil.convertToAvroObject("2.5", fieldSchema, StandardCharsets.UTF_8);
- assertTrue(convertedValue instanceof GenericFixed);
+ assertInstanceOf(GenericFixed.class, convertedValue);
final GenericFixed genericFixed = (GenericFixed) convertedValue;
final BigDecimal bigDecimal = new Conversions.DecimalConversion().fromFixed(genericFixed, fieldSchema, decimalType);
assertEquals(new BigDecimal("2.5").setScale(8), bigDecimal);
@@ -706,14 +708,14 @@ public class TestAvroTypeUtil {
@Test
public void testStringToBytesConversion() {
Object o = AvroTypeUtil.convertToAvroObject("Hello", Schema.create(Type.BYTES), StandardCharsets.UTF_16);
- assertTrue(o instanceof ByteBuffer);
+ assertInstanceOf(ByteBuffer.class, o);
assertEquals("Hello", new String(((ByteBuffer) o).array(), StandardCharsets.UTF_16));
}
@Test
public void testStringToNullableBytesConversion() {
Object o = AvroTypeUtil.convertToAvroObject("Hello", Schema.createUnion(Schema.create(Type.NULL), Schema.create(Type.BYTES)), StandardCharsets.UTF_16);
- assertTrue(o instanceof ByteBuffer);
+ assertInstanceOf(ByteBuffer.class, o);
assertEquals("Hello", new String(((ByteBuffer) o).array(), StandardCharsets.UTF_16));
}
@@ -721,7 +723,7 @@ public class TestAvroTypeUtil {
public void testBytesToStringConversion() {
final Charset charset = Charset.forName("UTF_32LE");
Object o = AvroTypeUtil.convertToAvroObject("Hello".getBytes(charset), Schema.create(Type.STRING), charset);
- assertTrue(o instanceof String);
+ assertInstanceOf(String.class, o);
assertEquals("Hello", o);
}
@@ -764,7 +766,7 @@ public class TestAvroTypeUtil {
public void testListToArrayConversion() {
final Charset charset = StandardCharsets.UTF_8;
Object o = AvroTypeUtil.convertToAvroObject(Collections.singletonList("Hello"), Schema.createArray(Schema.create(Type.STRING)), charset);
- assertTrue(o instanceof List);
+ assertInstanceOf(List.class, o);
assertEquals(1, ((List) o).size());
assertEquals("Hello", ((List) o).get(0));
}
@@ -774,7 +776,7 @@ public class TestAvroTypeUtil {
final Charset charset = StandardCharsets.UTF_8;
Object o = AvroTypeUtil.convertToAvroObject(Collections.singletonMap("Hello", "World"),
Schema.createRecord(null, null, null, false, Collections.singletonList(new Field("Hello", Schema.create(Type.STRING), "", ""))), charset);
- assertTrue(o instanceof Record);
+ assertInstanceOf(Record.class, o);
assertEquals("World", ((Record) o).get("Hello"));
}
@@ -796,12 +798,12 @@ public class TestAvroTypeUtil {
obj.put("List", list);
Object o = AvroTypeUtil.convertToAvroObject(obj, s);
- assertTrue(o instanceof Record);
+ assertInstanceOf(Record.class, o);
List innerList = (List) ((Record) o).get("List");
assertNotNull( innerList );
assertEquals(10, innerList.size());
for (Object inner : innerList) {
- assertTrue(inner instanceof Record);
+ assertInstanceOf(Record.class, inner);
assertNotNull(((Record) inner).get("Message"));
}
}
@@ -908,8 +910,8 @@ public class TestAvroTypeUtil {
// then
final HashMap<String, Object> numbers = (HashMap<String, Object>) result.get("numbers");
- assertTrue(Long.class.isInstance(numbers.get("number1")));
- assertTrue(Long.class.isInstance(numbers.get("number2")));
+ assertInstanceOf(Long.class, numbers.get("number1"));
+ assertInstanceOf(Long.class, numbers.get("number2"));
}
@Test
diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/test/java/org/apache/nifi/schema/access/InferenceSchemaStrategyTest.java b/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/test/java/org/apache/nifi/schema/access/InferenceSchemaStrategyTest.java
index 71186bc90b..4efb6543d8 100644
--- a/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/test/java/org/apache/nifi/schema/access/InferenceSchemaStrategyTest.java
+++ b/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/test/java/org/apache/nifi/schema/access/InferenceSchemaStrategyTest.java
@@ -36,8 +36,8 @@ import java.util.Map;
import java.util.Optional;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
public class InferenceSchemaStrategyTest {
@@ -89,7 +89,7 @@ public class InferenceSchemaStrategyTest {
// then
assertNotNull(result);
- assertTrue(RecordDataType.class.isInstance(result.getField("f1").get().getDataType()));
+ assertInstanceOf(RecordDataType.class, result.getField("f1").get().getDataType());
final RecordDataType recordDataType = (RecordDataType) result.getField("f1").get().getDataType();
final RecordSchema childSchema = recordDataType.getChildSchema();
diff --git a/nifi-extension-bundles/nifi-hazelcast-bundle/nifi-hazelcast-services/src/test/java/org/apache/nifi/hazelcast/services/cachemanager/ExternalHazelcastCacheManagerTest.java b/nifi-extension-bundles/nifi-hazelcast-bundle/nifi-hazelcast-services/src/test/java/org/apache/nifi/hazelcast/services/cachemanager/ExternalHazelcastCacheManagerTest.java
index 437d94dc37..6e090646e2 100644
--- a/nifi-extension-bundles/nifi-hazelcast-bundle/nifi-hazelcast-services/src/test/java/org/apache/nifi/hazelcast/services/cachemanager/ExternalHazelcastCacheManagerTest.java
+++ b/nifi-extension-bundles/nifi-hazelcast-bundle/nifi-hazelcast-services/src/test/java/org/apache/nifi/hazelcast/services/cachemanager/ExternalHazelcastCacheManagerTest.java
@@ -26,7 +26,7 @@ import org.junit.jupiter.api.Test;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
-import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
public class ExternalHazelcastCacheManagerTest extends AbstractHazelcastCacheManagerTest {
private HazelcastInstance hazelcastInstance;
@@ -55,7 +55,7 @@ public class ExternalHazelcastCacheManagerTest extends AbstractHazelcastCacheMan
testRunner.addControllerService("hazelcast-connection-service", testSubject);
final SocketAddress localAddress = hazelcastInstance.getLocalEndpoint().getSocketAddress();
- assertTrue(localAddress instanceof InetSocketAddress);
+ assertInstanceOf(InetSocketAddress.class, localAddress);
final int port = ((InetSocketAddress) localAddress).getPort();
testRunner.setProperty(testSubject, ExternalHazelcastCacheManager.HAZELCAST_SERVER_ADDRESS, "localhost:" + port);
diff --git a/nifi-extension-bundles/nifi-jms-bundle/nifi-jms-processors/src/test/java/org/apache/nifi/jms/processors/JMSPublisherConsumerIT.java b/nifi-extension-bundles/nifi-jms-bundle/nifi-jms-processors/src/test/java/org/apache/nifi/jms/processors/JMSPublisherConsumerIT.java
index c42a739f6e..babd460e14 100644
--- a/nifi-extension-bundles/nifi-jms-bundle/nifi-jms-processors/src/test/java/org/apache/nifi/jms/processors/JMSPublisherConsumerIT.java
+++ b/nifi-extension-bundles/nifi-jms-bundle/nifi-jms-processors/src/test/java/org/apache/nifi/jms/processors/JMSPublisherConsumerIT.java
@@ -51,6 +51,7 @@ import java.util.function.Consumer;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;
@@ -222,7 +223,7 @@ public class JMSPublisherConsumerIT {
publisher.publish(destinationName, "hellomq".getBytes());
Message receivedMessage = jmsTemplate.receive(destinationName);
- assertTrue(receivedMessage instanceof BytesMessage);
+ assertInstanceOf(BytesMessage.class, receivedMessage);
byte[] bytes = new byte[7];
((BytesMessage) receivedMessage).readBytes(bytes);
assertEquals("hellomq", new String(bytes));
@@ -249,11 +250,11 @@ public class JMSPublisherConsumerIT {
publisher.publish(destinationName, "hellomq".getBytes(), flowFileAttributes);
Message receivedMessage = jmsTemplate.receive(destinationName);
- assertTrue(receivedMessage instanceof BytesMessage);
+ assertInstanceOf(BytesMessage.class, receivedMessage);
assertEquals("foo", receivedMessage.getStringProperty("foo"));
assertTrue(receivedMessage.propertyExists("hyphen-property"));
assertTrue(receivedMessage.propertyExists("fullstop.property"));
- assertTrue(receivedMessage.getJMSReplyTo() instanceof Topic);
+ assertInstanceOf(Topic.class, receivedMessage.getJMSReplyTo());
assertEquals(1, receivedMessage.getJMSDeliveryMode());
assertEquals(1, receivedMessage.getJMSPriority());
assertEquals("myTopic", ((Topic) receivedMessage.getJMSReplyTo()).getTopicName());
diff --git a/nifi-extension-bundles/nifi-jms-bundle/nifi-jms-processors/src/test/java/org/apache/nifi/jms/processors/PublishJMSIT.java b/nifi-extension-bundles/nifi-jms-bundle/nifi-jms-processors/src/test/java/org/apache/nifi/jms/processors/PublishJMSIT.java
index 060445171c..c67585bc0b 100644
--- a/nifi-extension-bundles/nifi-jms-bundle/nifi-jms-processors/src/test/java/org/apache/nifi/jms/processors/PublishJMSIT.java
+++ b/nifi-extension-bundles/nifi-jms-bundle/nifi-jms-processors/src/test/java/org/apache/nifi/jms/processors/PublishJMSIT.java
@@ -71,6 +71,7 @@ import static org.apache.nifi.jms.processors.ioconcept.reader.record.ProvenanceE
import static org.apache.nifi.jms.processors.ioconcept.reader.StateTrackingFlowFileReader.ATTR_READ_FAILED_INDEX_SUFFIX;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -230,7 +231,7 @@ public class PublishJMSIT {
JmsTemplate jmst = new JmsTemplate(cf);
Message message = jmst.receive(destinationName);
- assertTrue(message instanceof TextMessage);
+ assertInstanceOf(TextMessage.class, message);
TextMessage textMessage = (TextMessage) message;
byte[] messageBytes = MessageBodyToBytesConverter.toBytes(textMessage);
@@ -291,23 +292,23 @@ public class PublishJMSIT {
byte[] messageBytes = MessageBodyToBytesConverter.toBytes(message);
assertEquals("Hey dude!", new String(messageBytes));
- assertEquals(true, message.getObjectProperty("foo") instanceof String);
+ assertInstanceOf(String.class, message.getObjectProperty("foo"));
assertEquals("foo", message.getStringProperty("foo"));
- assertEquals(true, message.getObjectProperty("myboolean") instanceof Boolean);
- assertEquals(true, message.getBooleanProperty("myboolean"));
- assertEquals(true, message.getObjectProperty("mybyte") instanceof Byte);
+ assertInstanceOf(Boolean.class, message.getObjectProperty("myboolean"));
+ assertTrue(message.getBooleanProperty("myboolean"));
+ assertInstanceOf(Byte.class, message.getObjectProperty("mybyte"));
assertEquals(127, message.getByteProperty("mybyte"));
- assertEquals(true, message.getObjectProperty("myshort") instanceof Short);
+ assertInstanceOf(Short.class, message.getObjectProperty("myshort"));
assertEquals(16384, message.getShortProperty("myshort"));
- assertEquals(true, message.getObjectProperty("myinteger") instanceof Integer);
+ assertInstanceOf(Integer.class, message.getObjectProperty("myinteger"));
assertEquals(1544000, message.getIntProperty("myinteger"));
- assertEquals(true, message.getObjectProperty("mylong") instanceof Long);
+ assertInstanceOf(Long.class, message.getObjectProperty("mylong"));
assertEquals(9876543210L, message.getLongProperty("mylong"));
- assertEquals(true, message.getObjectProperty("myfloat") instanceof Float);
+ assertInstanceOf(Float.class, message.getObjectProperty("myfloat"));
assertEquals(3.14F, message.getFloatProperty("myfloat"), 0.001F);
- assertEquals(true, message.getObjectProperty("mydouble") instanceof Double);
+ assertInstanceOf(Double.class, message.getObjectProperty("mydouble"));
assertEquals(3.14159265359D, message.getDoubleProperty("mydouble"), 0.00000000001D);
- assertEquals(true, message.getObjectProperty("badtype") instanceof String);
+ assertInstanceOf(String.class, message.getObjectProperty("badtype"));
assertEquals("3.14", message.getStringProperty("badtype"));
assertFalse(message.propertyExists("badint"));
@@ -348,7 +349,7 @@ public class PublishJMSIT {
JmsTemplate jmst = new JmsTemplate(cf);
Message message = jmst.receive(destinationName);
- assertTrue(message instanceof TextMessage);
+ assertInstanceOf(TextMessage.class, message);
TextMessage textMessage = (TextMessage) message;
byte[] messageBytes = MessageBodyToBytesConverter.toBytes(textMessage);
@@ -473,9 +474,9 @@ public class PublishJMSIT {
runner.enqueue("hi".getBytes(), flowFileAttributes);
runner.enqueue("hi".getBytes(), flowFileAttributes);
runner.run(2);
- assertTrue(threads == connectionFactoryProxy.openedConnections(), "It is expected at least " + threads + " Connection to be opened.");
- assertTrue(threads == connectionFactoryProxy.openedSessions(), "It is expected " + threads + " Session to be opened and there are " + connectionFactoryProxy.openedSessions());
- assertTrue(threads == connectionFactoryProxy.openedProducers(), "It is expected " + threads + " MessageProducer to be opened and there are " + connectionFactoryProxy.openedProducers());
+ assertEquals(threads, connectionFactoryProxy.openedConnections(), "It is expected at least " + threads + " Connection to be opened.");
+ assertEquals(threads, connectionFactoryProxy.openedSessions(), "It is expected " + threads + " Session to be opened and there are " + connectionFactoryProxy.openedSessions());
+ assertEquals(threads, connectionFactoryProxy.openedProducers(), "It is expected " + threads + " MessageProducer to be opened and there are " + connectionFactoryProxy.openedProducers());
assertTrue(connectionFactoryProxy.isAllResourcesClosed(), "Some resources were not closed.");
} finally {
if (broker != null) {
diff --git a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-transform-json-ui/src/test/java/org/apache/nifi/web/standard/api/processor/TestProcessorResource.java b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-transform-json-ui/src/test/java/org/apache/nifi/web/standard/api/processor/TestProcessorResource.java
index 6453c53181..e8ed4e3bf9 100644
--- a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-transform-json-ui/src/test/java/org/apache/nifi/web/standard/api/processor/TestProcessorResource.java
+++ b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-transform-json-ui/src/test/java/org/apache/nifi/web/standard/api/processor/TestProcessorResource.java
@@ -44,7 +44,6 @@ import java.util.Map;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.isNull;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
@@ -103,7 +102,7 @@ public class TestProcessorResource extends JerseyTest {
assertNotNull(response);
JsonNode jsonNode = response.readEntity(JsonNode.class);
assertNotNull(jsonNode);
- assertTrue(jsonNode.get("properties").get("Jolt Transform").asText().equals("jolt-transform-chain"));
+ assertEquals("jolt-transform-chain", jsonNode.get("properties").get("Jolt Transform").asText());
}
diff --git a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-transform-json-ui/src/test/java/org/apache/nifi/web/standard/api/processor/TestProcessorWebUtils.java b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-transform-json-ui/src/test/java/org/apache/nifi/web/standard/api/processor/TestProcessorWebUtils.java
index 503fd0011b..36c29258df 100644
--- a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-transform-json-ui/src/test/java/org/apache/nifi/web/standard/api/processor/TestProcessorWebUtils.java
+++ b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-transform-json-ui/src/test/java/org/apache/nifi/web/standard/api/processor/TestProcessorWebUtils.java
@@ -31,8 +31,8 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
@@ -64,7 +64,7 @@ public class TestProcessorWebUtils {
Method method = ProcessorWebUtils.class.getDeclaredMethod("getRequestContext", String.class, HttpServletRequest.class);
method.setAccessible(true);
NiFiWebRequestContext requestContext = (NiFiWebRequestContext) method.invoke(null, "1", mock(HttpServletRequest.class));
- assertTrue(requestContext instanceof HttpServletRequestContext);
+ assertInstanceOf(HttpServletRequestContext.class, requestContext);
assertEquals("1", requestContext.getId());
}
diff --git a/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-3-integration/src/test/java/org/apache/nifi/kafka/processors/PublishKafkaValueRecordIT.java b/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-3-integration/src/test/java/org/apache/nifi/kafka/processors/PublishKafkaValueRecordIT.java
index 4c7188c22e..08351c0266 100644
--- a/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-3-integration/src/test/java/org/apache/nifi/kafka/processors/PublishKafkaValueRecordIT.java
+++ b/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-3-integration/src/test/java/org/apache/nifi/kafka/processors/PublishKafkaValueRecordIT.java
@@ -40,9 +40,9 @@ import java.util.Map;
import java.util.Objects;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
@TestMethodOrder(MethodOrderer.MethodName.class)
public class PublishKafkaValueRecordIT extends AbstractPublishKafkaIT {
@@ -102,7 +102,7 @@ public class PublishKafkaValueRecordIT extends AbstractPublishKafkaIT {
assertNotNull(kafkaValue);
assertNotEquals(0, kafkaValue.get("id").asInt());
assertEquals(1, kafkaValue.get("name").asText().length());
- assertTrue(kafkaValue.get("address") instanceof ObjectNode);
+ assertInstanceOf(ObjectNode.class, kafkaValue.get("address"));
}
}
}
diff --git a/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-3-integration/src/test/java/org/apache/nifi/kafka/processors/publish/additional/PublishKafkaContentX1IT.java b/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-3-integration/src/test/java/org/apache/nifi/kafka/processors/publish/additional/PublishKafkaContentX1IT.java
index f7fba11276..15ddd4eb75 100644
--- a/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-3-integration/src/test/java/org/apache/nifi/kafka/processors/publish/additional/PublishKafkaContentX1IT.java
+++ b/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-3-integration/src/test/java/org/apache/nifi/kafka/processors/publish/additional/PublishKafkaContentX1IT.java
@@ -43,6 +43,7 @@ import java.util.Map;
import java.util.Objects;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -97,7 +98,7 @@ public class PublishKafkaContentX1IT extends AbstractPublishKafkaIT {
assertNotNull(kafkaValue);
assertEquals("1234 First Street", kafkaValue.get("address").textValue());
assertEquals("12345", kafkaValue.get("zip").textValue());
- assertTrue(kafkaValue.get("account") instanceof ObjectNode);
+ assertInstanceOf(ObjectNode.class, kafkaValue.get("account"));
}
}
}
diff --git a/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-3-integration/src/test/java/org/apache/nifi/kafka/processors/publish/additional/PublishKafkaWrapperX1IT.java b/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-3-integration/src/test/java/org/apache/nifi/kafka/processors/publish/additional/PublishKafkaWrapperX1IT.java
index 12e6973812..3c8cd8b7a5 100644
--- a/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-3-integration/src/test/java/org/apache/nifi/kafka/processors/publish/additional/PublishKafkaWrapperX1IT.java
+++ b/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-3-integration/src/test/java/org/apache/nifi/kafka/processors/publish/additional/PublishKafkaWrapperX1IT.java
@@ -43,6 +43,7 @@ import java.util.Map;
import java.util.Objects;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -88,7 +89,7 @@ public class PublishKafkaWrapperX1IT extends AbstractPublishKafkaIT {
assertNotNull(kafkaValue);
assertEquals("1234 First Street", kafkaValue.get("address").textValue());
assertEquals("12345", kafkaValue.get("zip").textValue());
- assertTrue(kafkaValue.get("account") instanceof ObjectNode);
+ assertInstanceOf(ObjectNode.class, kafkaValue.get("account"));
}
}
}
diff --git a/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-3-integration/src/test/java/org/apache/nifi/kafka/processors/publish/additional/PublishKafkaWrapperX2IT.java b/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-3-integration/src/test/java/org/apache/nifi/kafka/processors/publish/additional/PublishKafkaWrapperX2IT.java
index 71299901d0..8f964b216b 100644
--- a/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-3-integration/src/test/java/org/apache/nifi/kafka/processors/publish/additional/PublishKafkaWrapperX2IT.java
+++ b/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-3-integration/src/test/java/org/apache/nifi/kafka/processors/publish/additional/PublishKafkaWrapperX2IT.java
@@ -41,6 +41,7 @@ import java.util.Map;
import java.util.Objects;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -94,7 +95,7 @@ public class PublishKafkaWrapperX2IT extends AbstractPublishKafkaIT {
assertNotNull(kafkaValue);
assertEquals("1234 First Street", kafkaValue.get("address").textValue());
assertEquals("12345", kafkaValue.get("zip").textValue());
- assertTrue(kafkaValue.get("account") instanceof ObjectNode);
+ assertInstanceOf(ObjectNode.class, kafkaValue.get("account"));
}
}
}
diff --git a/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-3-integration/src/test/java/org/apache/nifi/kafka/processors/publish/additional/PublishKafkaWrapperX3IT.java b/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-3-integration/src/test/java/org/apache/nifi/kafka/processors/publish/additional/PublishKafkaWrapperX3IT.java
index 406451f3ef..552ff124c4 100644
--- a/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-3-integration/src/test/java/org/apache/nifi/kafka/processors/publish/additional/PublishKafkaWrapperX3IT.java
+++ b/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-3-integration/src/test/java/org/apache/nifi/kafka/processors/publish/additional/PublishKafkaWrapperX3IT.java
@@ -43,6 +43,7 @@ import java.util.Map;
import java.util.Objects;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -91,7 +92,7 @@ public class PublishKafkaWrapperX3IT extends AbstractPublishKafkaIT {
assertNotNull(kafkaValue);
assertEquals("1234 First Street", kafkaValue.get("address").textValue());
assertEquals("12345", kafkaValue.get("zip").textValue());
- assertTrue(kafkaValue.get("account") instanceof ObjectNode);
+ assertInstanceOf(ObjectNode.class, kafkaValue.get("account"));
}
}
}
diff --git a/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-3-integration/src/test/java/org/apache/nifi/kafka/processors/publish/additional/PublishKafkaWrapperX4IT.java b/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-3-integration/src/test/java/org/apache/nifi/kafka/processors/publish/additional/PublishKafkaWrapperX4IT.java
index d16387d59b..3c978851ab 100644
--- a/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-3-integration/src/test/java/org/apache/nifi/kafka/processors/publish/additional/PublishKafkaWrapperX4IT.java
+++ b/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-3-integration/src/test/java/org/apache/nifi/kafka/processors/publish/additional/PublishKafkaWrapperX4IT.java
@@ -43,6 +43,7 @@ import java.util.Map;
import java.util.Objects;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -94,7 +95,7 @@ public class PublishKafkaWrapperX4IT extends AbstractPublishKafkaIT {
assertNotNull(kafkaValue);
assertEquals("1234 First Street", kafkaValue.get("address").textValue());
assertEquals("12345", kafkaValue.get("zip").textValue());
- assertTrue(kafkaValue.get("account") instanceof ObjectNode);
+ assertInstanceOf(ObjectNode.class, kafkaValue.get("account"));
}
}
}
diff --git a/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-3-integration/src/test/java/org/apache/nifi/kafka/processors/publish/additional/PublishKafkaWrapperX5IT.java b/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-3-integration/src/test/java/org/apache/nifi/kafka/processors/publish/additional/PublishKafkaWrapperX5IT.java
index 3de3da9417..5f1b8d28b4 100644
--- a/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-3-integration/src/test/java/org/apache/nifi/kafka/processors/publish/additional/PublishKafkaWrapperX5IT.java
+++ b/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-3-integration/src/test/java/org/apache/nifi/kafka/processors/publish/additional/PublishKafkaWrapperX5IT.java
@@ -54,6 +54,7 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -135,7 +136,7 @@ public class PublishKafkaWrapperX5IT extends AbstractPublishKafkaIT {
assertNotNull(kafkaValue);
assertEquals("1234 First Street", kafkaValue.get("address").textValue());
assertEquals("12345", kafkaValue.get("zip").textValue());
- assertTrue(kafkaValue.get("account") instanceof ObjectNode);
+ assertInstanceOf(ObjectNode.class, kafkaValue.get("account"));
}
}
}
diff --git a/nifi-extension-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/test/java/org/apache/nifi/processors/mongodb/GetMongoIT.java b/nifi-extension-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/test/java/org/apache/nifi/processors/mongodb/GetMongoIT.java
index 2e7edeac5e..cec3b81208 100644
--- a/nifi-extension-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/test/java/org/apache/nifi/processors/mongodb/GetMongoIT.java
+++ b/nifi-extension-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/test/java/org/apache/nifi/processors/mongodb/GetMongoIT.java
@@ -50,6 +50,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class GetMongoIT extends AbstractMongoIT {
@@ -181,7 +182,7 @@ public class GetMongoIT extends AbstractMongoIT {
ObjectMapper mapper = new ObjectMapper();
Map<String, Object> parsed = mapper.readValue(raw, Map.class);
- assertTrue(parsed.get("date_field").getClass() == String.class);
+ assertSame(parsed.get("date_field").getClass(), String.class);
}
@Test
diff --git a/nifi-extension-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/test/java/org/apache/nifi/processors/mongodb/RunMongoAggregationIT.java b/nifi-extension-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/test/java/org/apache/nifi/processors/mongodb/RunMongoAggregationIT.java
index e8738819cc..eab684dcf4 100644
--- a/nifi-extension-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/test/java/org/apache/nifi/processors/mongodb/RunMongoAggregationIT.java
+++ b/nifi-extension-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/test/java/org/apache/nifi/processors/mongodb/RunMongoAggregationIT.java
@@ -202,7 +202,7 @@ public class RunMongoAggregationIT extends AbstractMongoIT {
for (MockFlowFile mockFlowFile : flowFiles) {
byte[] raw = runner.getContentAsByteArray(mockFlowFile);
Map<String, List<Long>> read = mapper.readValue(raw, Map.class);
- assertTrue(read.get("myArray").get(1) == now.getTimeInMillis());
+ assertEquals((long) read.get("myArray").get(1), now.getTimeInMillis());
}
}
diff --git a/nifi-extension-bundles/nifi-mongodb-bundle/nifi-mongodb-services/src/test/java/org/apache/nifi/mongodb/MongoDBLookupServiceIT.java b/nifi-extension-bundles/nifi-mongodb-bundle/nifi-mongodb-services/src/test/java/org/apache/nifi/mongodb/MongoDBLookupServiceIT.java
index a95d224763..fc1bed79d6 100644
--- a/nifi-extension-bundles/nifi-mongodb-bundle/nifi-mongodb-services/src/test/java/org/apache/nifi/mongodb/MongoDBLookupServiceIT.java
+++ b/nifi-extension-bundles/nifi-mongodb-bundle/nifi-mongodb-services/src/test/java/org/apache/nifi/mongodb/MongoDBLookupServiceIT.java
@@ -45,6 +45,8 @@ import java.util.Optional;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -122,7 +124,7 @@ public class MongoDBLookupServiceIT extends AbstractMongoIT {
fail();
}
- assertTrue(!result.isPresent());
+ assertFalse(result.isPresent());
}
@Test
@@ -211,7 +213,7 @@ public class MongoDBLookupServiceIT extends AbstractMongoIT {
Optional result = service.lookup(criteria);
assertNotNull(result.get(), "The value was null.");
- assertTrue(result.get() instanceof MapRecord, "The value was wrong.");
+ assertInstanceOf(MapRecord.class, result.get(), "The value was wrong.");
MapRecord record = (MapRecord) result.get();
RecordSchema subSchema = ((RecordDataType) record.getSchema().getField("subrecordField").get().getDataType()).getChildSchema();
@@ -238,7 +240,7 @@ public class MongoDBLookupServiceIT extends AbstractMongoIT {
fail();
}
- assertTrue(!result.isPresent());
+ assertFalse(result.isPresent());
}
@Test
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestExecuteSQLRecord.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestExecuteSQLRecord.java
index f4671b685b..ac650f5cd3 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestExecuteSQLRecord.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestExecuteSQLRecord.java
@@ -59,9 +59,9 @@ 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.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.mock;
@@ -462,17 +462,17 @@ public class TestExecuteSQLRecord {
Object imageObj = avroRecord.get("IMAGE");
assertNotNull(imageObj);
- assertTrue(imageObj instanceof ByteBuffer);
+ assertInstanceOf(ByteBuffer.class, imageObj);
assertArrayEquals(new byte[]{(byte) 0xDE, (byte) 0xAD, (byte) 0xBE, (byte) 0xEF}, ((ByteBuffer) imageObj).array());
Object wordsObj = avroRecord.get("WORDS");
assertNotNull(wordsObj);
- assertTrue(wordsObj instanceof Utf8);
+ assertInstanceOf(Utf8.class, wordsObj);
assertEquals("Hello World", wordsObj.toString());
Object natwordsObj = avroRecord.get("NATWORDS");
assertNotNull(natwordsObj);
- assertTrue(natwordsObj instanceof Utf8);
+ assertInstanceOf(Utf8.class, natwordsObj);
assertEquals("I am an NCLOB", natwordsObj.toString());
}
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestFetchFile.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestFetchFile.java
index 79641d255a..05a0b5508e 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestFetchFile.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestFetchFile.java
@@ -28,8 +28,8 @@ import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.StandardOpenOption;
-import java.util.Arrays;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -250,7 +250,7 @@ public class TestFetchFile {
runner.getFlowFilesForRelationship(FetchFile.REL_SUCCESS).get(0).assertContentEquals(content);
final byte[] replacedContent = Files.readAllBytes(destFile.toPath());
- assertTrue(Arrays.equals(content, replacedContent));
+ assertArrayEquals(content, replacedContent);
assertFalse(sourceFile.exists());
assertTrue(destFile.exists());
}
@@ -281,7 +281,7 @@ public class TestFetchFile {
runner.getFlowFilesForRelationship(FetchFile.REL_SUCCESS).get(0).assertContentEquals(content);
final byte[] replacedContent = Files.readAllBytes(destFile.toPath());
- assertTrue(Arrays.equals(goodBye, replacedContent));
+ assertArrayEquals(goodBye, replacedContent);
assertFalse(sourceFile.exists());
assertTrue(destFile.exists());
}
@@ -311,7 +311,7 @@ public class TestFetchFile {
runner.assertAllFlowFilesTransferred(FetchFile.REL_FAILURE, 1);
final byte[] replacedContent = Files.readAllBytes(destFile.toPath());
- assertTrue(Arrays.equals(goodBye, replacedContent));
+ assertArrayEquals(goodBye, replacedContent);
assertTrue(sourceFile.exists());
assertTrue(destFile.exists());
}
@@ -342,7 +342,7 @@ public class TestFetchFile {
runner.assertAllFlowFilesTransferred(FetchFile.REL_SUCCESS, 1);
final byte[] replacedContent = Files.readAllBytes(destFile.toPath());
- assertTrue(Arrays.equals(goodBye, replacedContent));
+ assertArrayEquals(goodBye, replacedContent);
assertFalse(sourceFile.exists());
assertTrue(destFile.exists());
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestFlattenJson.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestFlattenJson.java
index 1d3bc56842..c601818352 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestFlattenJson.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestFlattenJson.java
@@ -32,7 +32,6 @@ import java.util.Map;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
-import static org.junit.jupiter.api.Assertions.assertTrue;
public class TestFlattenJson {
private static final ObjectMapper mapper = new ObjectMapper();
@@ -86,7 +85,7 @@ public class TestFlattenJson {
final List<String> expected = Arrays.asList("Hello", "World");
final List parsed = (List) baseTest(testRunner, json, 2);
- assertTrue(parsed instanceof List, "Not a list");
+ assertInstanceOf(List.class, parsed, "Not a list");
for (int i = 0; i < parsed.size(); i++) {
final Map map = (Map) parsed.get(i);
assertEquals(map.get("first.second"), expected.get(i), "Missing values.");
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestGenerateRecord.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestGenerateRecord.java
index cf3c46f26f..35638332b7 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestGenerateRecord.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestGenerateRecord.java
@@ -25,6 +25,7 @@ import org.apache.nifi.processors.standard.faker.FakerMethodHolder;
import org.apache.nifi.processors.standard.faker.FakerUtils;
import org.apache.nifi.serialization.RecordReader;
import org.apache.nifi.serialization.record.MockRecordWriter;
+import org.apache.nifi.serialization.record.Record;
import org.apache.nifi.serialization.record.RecordField;
import org.apache.nifi.serialization.record.RecordFieldType;
import org.apache.nifi.serialization.record.RecordSchema;
@@ -48,6 +49,7 @@ import java.util.Optional;
import java.util.stream.Collectors;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
@@ -246,19 +248,19 @@ public class TestGenerateRecord {
assertNotNull(record);
final Object systemObject = record.getValue("System");
assertNotNull(systemObject);
- assertTrue(systemObject instanceof org.apache.nifi.serialization.record.Record);
+ assertInstanceOf(Record.class, systemObject);
final org.apache.nifi.serialization.record.Record systemRecord = (org.apache.nifi.serialization.record.Record) systemObject;
final Object providerObject = systemRecord.getValue("Provider");
assertNotNull(providerObject);
- assertTrue(providerObject instanceof org.apache.nifi.serialization.record.Record);
+ assertInstanceOf(Record.class, providerObject);
final org.apache.nifi.serialization.record.Record providerRecord = (org.apache.nifi.serialization.record.Record) providerObject;
final Object guidObject = providerRecord.getValue("Guid");
assertNotNull(guidObject);
- assertTrue(guidObject instanceof Object[]);
+ assertInstanceOf(Object[].class, guidObject);
// Check for array of Byte objects if not empty
Object[] guidArray = (Object[]) guidObject;
if (guidArray.length > 0) {
- assertTrue(guidArray[0] instanceof Byte);
+ assertInstanceOf(Byte.class, guidArray[0]);
}
}
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestNotify.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestNotify.java
index 6258f39dd0..384e5f3778 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestNotify.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestNotify.java
@@ -36,6 +36,7 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -304,7 +305,7 @@ public class TestNotify {
props.put("releaseSignalAttribute", "2");
runner.enqueue(new byte[] {}, props);
final AssertionError e = assertThrows(AssertionError.class, () -> runner.run());
- assertTrue(e.getCause() instanceof RuntimeException);
+ assertInstanceOf(RuntimeException.class, e.getCause());
service.setFailOnCalls(false);
}
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestReplaceText.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestReplaceText.java
index 50c8794f98..125bda88a1 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestReplaceText.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestReplaceText.java
@@ -850,7 +850,7 @@ public class TestReplaceText {
runner.assertAllFlowFilesTransferred(ReplaceText.REL_SUCCESS, 1);
final MockFlowFile out = runner.getFlowFilesForRelationship(ReplaceText.REL_SUCCESS).get(0);
final String outContent = new String(out.toByteArray(), StandardCharsets.UTF_8);
- assertTrue(outContent.equals("attribute header\n\nabc.txt\n\ndata header\n\nHello\nWorld!\n\nfooter"));
+ assertEquals("attribute header\n\nabc.txt\n\ndata header\n\nHello\nWorld!\n\nfooter", outContent);
}
@Test
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestSplitRecord.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestSplitRecord.java
index a3e4926bbf..1f026aa562 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestSplitRecord.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestSplitRecord.java
@@ -33,6 +33,7 @@ import java.util.List;
import java.util.Optional;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class TestSplitRecord {
@@ -193,7 +194,7 @@ public class TestSplitRecord {
runner.assertAllFlowFilesTransferred(SplitRecord.REL_FAILURE, 1);
final MockFlowFile failed = runner.getFlowFilesForRelationship(SplitRecord.REL_FAILURE).get(0);
- assertTrue(original == failed);
+ assertSame(original, failed);
final MockComponentLog logger = runner.getLogger();
final Optional<LogMessage> logMessage = logger.getErrorMessages().stream()
diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/enrichment/TestInsertRecordFieldsJoinStrategy.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/enrichment/TestInsertRecordFieldsJoinStrategy.java
index 8777602663..edabb3f6eb 100644
--- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/enrichment/TestInsertRecordFieldsJoinStrategy.java
+++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/enrichment/TestInsertRecordFieldsJoinStrategy.java
@@ -37,6 +37,7 @@ 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.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -167,7 +168,7 @@ public class TestInsertRecordFieldsJoinStrategy extends TestIndexCorrelatedJoinS
assertEquals(555, combined.getAsInt("id"));
final Object xyzValue = combined.getValue("xyz");
- assertTrue(xyzValue instanceof Record);
+ assertInstanceOf(Record.class, xyzValue);
final Record xyzRecord = (Record) xyzValue;
assertEquals("John Doe", xyzRecord.getValue("name"));
diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-dbcp-service/src/test/java/org/apache/nifi/dbcp/TestDBCPConnectionPoolLookup.java b/nifi-extension-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-dbcp-service/src/test/java/org/apache/nifi/dbcp/TestDBCPConnectionPoolLookup.java
index 7bd8416cb4..bda3bde955 100644
--- a/nifi-extension-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-dbcp-service/src/test/java/org/apache/nifi/dbcp/TestDBCPConnectionPoolLookup.java
+++ b/nifi-extension-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-dbcp-service/src/test/java/org/apache/nifi/dbcp/TestDBCPConnectionPoolLookup.java
@@ -33,9 +33,9 @@ import java.util.HashMap;
import java.util.Map;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotNull;
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;
@@ -88,7 +88,7 @@ public class TestDBCPConnectionPoolLookup {
final Connection connection = dbcpLookupService.getConnection(attributes);
assertNotNull(connection);
- assertTrue(connection instanceof MockConnection);
+ assertInstanceOf(MockConnection.class, connection);
final MockConnection mockConnection = (MockConnection) connection;
assertEquals(connectionA.getName(), mockConnection.getName());
@@ -101,7 +101,7 @@ public class TestDBCPConnectionPoolLookup {
final Connection connection = dbcpLookupService.getConnection(attributes);
assertNotNull(connection);
- assertTrue(connection instanceof MockConnection);
+ assertInstanceOf(MockConnection.class, connection);
final MockConnection mockConnection = (MockConnection) connection;
assertEquals(connectionB.getName(), mockConnection.getName());
diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-dbcp-service/src/test/java/org/apache/nifi/record/sink/db/DatabaseRecordSinkTest.java b/nifi-extension-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-dbcp-service/src/test/java/org/apache/nifi/record/sink/db/DatabaseRecordSinkTest.java
index 239b0594b6..715e3c7764 100644
--- a/nifi-extension-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-dbcp-service/src/test/java/org/apache/nifi/record/sink/db/DatabaseRecordSinkTest.java
+++ b/nifi-extension-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-dbcp-service/src/test/java/org/apache/nifi/record/sink/db/DatabaseRecordSinkTest.java
@@ -82,6 +82,7 @@ import static org.apache.nifi.dbcp.utils.DBCPProperties.SOFT_MIN_EVICTABLE_IDLE_
import static org.apache.nifi.dbcp.utils.DBCPProperties.VALIDATION_QUERY;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -185,22 +186,22 @@ public class DatabaseRecordSinkTest {
Object f1 = resultSet.getObject(1);
assertNotNull(f1);
- assertTrue(f1 instanceof Integer);
+ assertInstanceOf(Integer.class, f1);
assertEquals(15, f1);
Object f2 = resultSet.getObject(2);
assertNotNull(f2);
- assertTrue(f2 instanceof String);
+ assertInstanceOf(String.class, f2);
assertEquals("Hello", f2);
assertTrue(resultSet.next());
f1 = resultSet.getObject(1);
assertNotNull(f1);
- assertTrue(f1 instanceof Integer);
+ assertInstanceOf(Integer.class, f1);
assertEquals(6, f1);
f2 = resultSet.getObject(2);
assertNotNull(f2);
- assertTrue(f2 instanceof String);
+ assertInstanceOf(String.class, f2);
assertEquals("World!", f2);
assertFalse(resultSet.next());
diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/avro/TestWriteAvroResult.java b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/avro/TestWriteAvroResult.java
index 6622bc5b63..3844774704 100644
--- a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/avro/TestWriteAvroResult.java
+++ b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/avro/TestWriteAvroResult.java
@@ -59,8 +59,8 @@ import java.util.Objects;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
public abstract class TestWriteAvroResult {
@@ -342,8 +342,7 @@ public abstract class TestWriteAvroResult {
assertEquals(objectArray[i], bb.get());
}
} else if (recordValue instanceof Object[]) {
- assertTrue(avroValue instanceof Array,
- fieldName + " should have been instanceof Array");
+ assertInstanceOf(Array.class, avroValue, fieldName + " should have been instanceof Array");
final Array<?> avroArray = (Array<?>) avroValue;
final Object[] recordArray = (Object[]) recordValue;
assertEquals(recordArray.length, avroArray.size(),
@@ -357,8 +356,7 @@ public abstract class TestWriteAvroResult {
assertEquals(bb, avroValue,
fieldName + " not equal");
} else if (recordValue instanceof Map) {
- assertTrue(avroValue instanceof Map,
- fieldName + " should have been instanceof Map");
+ assertInstanceOf(Map.class, avroValue, fieldName + " should have been instanceof Map");
final Map<?, ?> avroMap = (Map<?, ?>) avroValue;
final Map<?, ?> recordMap = (Map<?, ?>) recordValue;
assertEquals(recordMap.size(), avroMap.size(),
diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/cef/TestCEFReader.java b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/cef/TestCEFReader.java
index 240c68dd55..262fccc1d8 100644
--- a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/cef/TestCEFReader.java
+++ b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/cef/TestCEFReader.java
@@ -35,7 +35,6 @@ import org.apache.nifi.serialization.record.Record;
import org.apache.nifi.serialization.record.RecordField;
import org.apache.nifi.util.TestRunner;
import org.apache.nifi.util.TestRunners;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -51,6 +50,10 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
public class TestCEFReader {
private TestRunner runner;
private TestCEFProcessor processor;
@@ -264,13 +267,13 @@ public class TestCEFReader {
private void triggerProcessorWithError(final String input) throws FileNotFoundException {
runner.enqueue(new FileInputStream(input));
- final AssertionError exception = Assertions.assertThrows(AssertionError.class, () -> runner.run());
- Assertions.assertTrue(exception.getCause() instanceof RuntimeException);
- Assertions.assertTrue(exception.getCause().getCause() instanceof IOException);
+ final AssertionError exception = assertThrows(AssertionError.class, () -> runner.run());
+ assertInstanceOf(RuntimeException.class, exception.getCause());
+ assertInstanceOf(IOException.class, exception.getCause().getCause());
}
private void assertNumberOfResults(final int numberOfResults) {
- Assertions.assertEquals(numberOfResults, processor.getRecords().size());
+ assertEquals(numberOfResults, processor.getRecords().size());
}
private void assertReaderIsInvalid() {
@@ -278,7 +281,7 @@ public class TestCEFReader {
}
private void assertFieldIsSet(final int number, final String name, final String value) {
- Assertions.assertEquals(value, processor.getRecords().get(number).getValue(name));
+ assertEquals(value, processor.getRecords().get(number).getValue(name));
}
private void assertFieldsAre(final Map<String, Object>... fieldGroups) {
diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/json/TestJsonPathRowRecordReader.java b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/json/TestJsonPathRowRecordReader.java
index 479be94115..99e7ee5634 100644
--- a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/json/TestJsonPathRowRecordReader.java
+++ b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/json/TestJsonPathRowRecordReader.java
@@ -34,6 +34,7 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -43,6 +44,7 @@ import java.util.stream.Collectors;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -181,12 +183,10 @@ class TestJsonPathRowRecordReader {
final Record record = reader.nextRecord(coerceTypes, false);
final Object value = record.getValue("timestamp");
- assertTrue(value instanceof java.sql.Timestamp,
- "With coerceTypes set to " + coerceTypes + ", value is not a Timestamp");
+ assertInstanceOf(Timestamp.class, value, "With coerceTypes set to " + coerceTypes + ", value is not a Timestamp");
final Object valueNotInSchema = record.getValue("field_not_in_schema");
- assertTrue(valueNotInSchema instanceof String,
- "field_not_in_schema should be String");
+ assertInstanceOf(String.class, valueNotInSchema, "field_not_in_schema should be String");
}
}
}
@@ -220,7 +220,7 @@ class TestJsonPathRowRecordReader {
assertArrayEquals(new Object[] {1, "John Doe", null, "123 My Street", "My City", "MS", "11111", "USA"}, simpleElements);
final Object lastElement = firstRecordValues[firstRecordValues.length - 1];
- assertTrue(lastElement instanceof Record);
+ assertInstanceOf(Record.class, lastElement);
final Record record = (Record) lastElement;
assertEquals(42, record.getValue("id"));
assertEquals(4750.89D, record.getValue("balance"));
@@ -263,14 +263,14 @@ class TestJsonPathRowRecordReader {
final Object[] array = (Object[]) lastRecord;
assertEquals(2, array.length);
final Object firstElement = array[0];
- assertTrue(firstElement instanceof Record);
+ assertInstanceOf(Record.class, firstElement);
final Record firstRecord = (Record) firstElement;
assertEquals(42, firstRecord.getValue("id"));
assertEquals(4750.89D, firstRecord.getValue("balance"));
final Object secondElement = array[1];
- assertTrue(secondElement instanceof Record);
+ assertInstanceOf(Record.class, secondElement);
final Record secondRecord = (Record) secondElement;
assertEquals(43, secondRecord.getValue("id"));
assertEquals(48212.38D, secondRecord.getValue("balance"));
diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/windowsevent/TestWindowsEventLogRecordReader.java b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/windowsevent/TestWindowsEventLogRecordReader.java
index 38d967fe5d..ad309660fc 100644
--- a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/windowsevent/TestWindowsEventLogRecordReader.java
+++ b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/windowsevent/TestWindowsEventLogRecordReader.java
@@ -31,10 +31,10 @@ import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.junit.jupiter.api.Assertions.assertTrue;
public class TestWindowsEventLogRecordReader {
@@ -53,12 +53,12 @@ public class TestWindowsEventLogRecordReader {
// Verify some System fields
Object childObj = r.getValue("System");
assertNotNull(childObj);
- assertTrue(childObj instanceof Record);
+ assertInstanceOf(Record.class, childObj);
Record childRecord = (Record) childObj;
assertEquals(14, childRecord.getValues().length);
childObj = childRecord.getValue("Provider");
assertNotNull(childObj);
- assertTrue(childObj instanceof Record);
+ assertInstanceOf(Record.class, childObj);
childRecord = (Record) childObj;
assertEquals(2, childRecord.getValues().length);
assertEquals("Microsoft-Windows-Security-Auditing", childRecord.getAsString("Name"));
@@ -66,7 +66,7 @@ public class TestWindowsEventLogRecordReader {
// Verify some EventData fields, including Data fields
childObj = r.getValue("EventData");
assertNotNull(childObj);
- assertTrue(childObj instanceof Record);
+ assertInstanceOf(Record.class, childObj);
childRecord = (Record) childObj;
assertEquals(4, childRecord.getValues().length);
assertEquals("DOMAIN", childRecord.getAsString("TargetDomainName"));
@@ -85,12 +85,12 @@ public class TestWindowsEventLogRecordReader {
// Verify some System fields
Object childObj = r.getValue("System");
assertNotNull(childObj);
- assertTrue(childObj instanceof Record);
+ assertInstanceOf(Record.class, childObj);
Record childRecord = (Record) childObj;
assertEquals(14, childRecord.getValues().length);
childObj = childRecord.getValue("Provider");
assertNotNull(childObj);
- assertTrue(childObj instanceof Record);
+ assertInstanceOf(Record.class, childObj);
childRecord = (Record) childObj;
assertEquals(2, childRecord.getValues().length);
assertEquals("Microsoft-Windows-Security-Auditing", childRecord.getAsString("Name"));
@@ -98,7 +98,7 @@ public class TestWindowsEventLogRecordReader {
// Verify some EventData fields, including Data fields
childObj = r.getValue("EventData");
assertNotNull(childObj);
- assertTrue(childObj instanceof Record);
+ assertInstanceOf(Record.class, childObj);
childRecord = (Record) childObj;
assertEquals(4, childRecord.getValues().length);
assertEquals("DOMAIN", childRecord.getAsString("TargetDomainName"));
@@ -117,12 +117,12 @@ public class TestWindowsEventLogRecordReader {
// Verify some System fields
Object childObj = r.getValue("System");
assertNotNull(childObj);
- assertTrue(childObj instanceof Record);
+ assertInstanceOf(Record.class, childObj);
Record childRecord = (Record) childObj;
assertEquals(14, childRecord.getValues().length);
childObj = childRecord.getValue("Provider");
assertNotNull(childObj);
- assertTrue(childObj instanceof Record);
+ assertInstanceOf(Record.class, childObj);
childRecord = (Record) childObj;
assertEquals(2, childRecord.getValues().length);
assertEquals("Microsoft-Windows-Security-Auditing", childRecord.getAsString("Name"));
@@ -130,7 +130,7 @@ public class TestWindowsEventLogRecordReader {
// Verify some EventData fields, including Data fields
childObj = r.getValue("EventData");
assertNotNull(childObj);
- assertTrue(childObj instanceof Record);
+ assertInstanceOf(Record.class, childObj);
childRecord = (Record) childObj;
assertEquals(16, childRecord.getValues().length);
assertEquals("DOMAIN", childRecord.getAsString("TargetDomainName"));
@@ -142,12 +142,12 @@ public class TestWindowsEventLogRecordReader {
assertEquals(2, r.getValues().length);
childObj = r.getValue("System");
assertNotNull(childObj);
- assertTrue(childObj instanceof Record);
+ assertInstanceOf(Record.class, childObj);
childRecord = (Record) childObj;
assertEquals(14, childRecord.getValues().length);
childObj = childRecord.getValue("Provider");
assertNotNull(childObj);
- assertTrue(childObj instanceof Record);
+ assertInstanceOf(Record.class, childObj);
childRecord = (Record) childObj;
assertEquals(2, childRecord.getValues().length);
assertEquals("Microsoft-Windows-Security-Auditing", childRecord.getAsString("Name"));
@@ -155,7 +155,7 @@ public class TestWindowsEventLogRecordReader {
// Verify some EventData fields, including Data fields
childObj = r.getValue("EventData");
assertNotNull(childObj);
- assertTrue(childObj instanceof Record);
+ assertInstanceOf(Record.class, childObj);
childRecord = (Record) childObj;
assertEquals(16, childRecord.getValues().length);
assertEquals("DOMAIN", childRecord.getAsString("TargetDomainName"));
@@ -167,12 +167,12 @@ public class TestWindowsEventLogRecordReader {
assertEquals(2, r.getValues().length);
childObj = r.getValue("System");
assertNotNull(childObj);
- assertTrue(childObj instanceof Record);
+ assertInstanceOf(Record.class, childObj);
childRecord = (Record) childObj;
assertEquals(14, childRecord.getValues().length);
childObj = childRecord.getValue("Provider");
assertNotNull(childObj);
- assertTrue(childObj instanceof Record);
+ assertInstanceOf(Record.class, childObj);
childRecord = (Record) childObj;
assertEquals(2, childRecord.getValues().length);
assertEquals("Microsoft-Windows-Security-Auditing", childRecord.getAsString("Name"));
@@ -180,7 +180,7 @@ public class TestWindowsEventLogRecordReader {
// Verify some EventData fields, including Data fields
childObj = r.getValue("EventData");
assertNotNull(childObj);
- assertTrue(childObj instanceof Record);
+ assertInstanceOf(Record.class, childObj);
childRecord = (Record) childObj;
assertEquals(16, childRecord.getValues().length);
assertNull(childRecord.getAsString("TargetDomainName"));
diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/xml/TestInferXmlSchema.java b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/xml/TestInferXmlSchema.java
index e45b9fb8f8..a140b179b6 100644
--- a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/xml/TestInferXmlSchema.java
+++ b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/xml/TestInferXmlSchema.java
@@ -39,8 +39,8 @@ import java.io.InputStream;
import java.util.Collections;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertSame;
-import static org.junit.jupiter.api.Assertions.assertTrue;
public class TestInferXmlSchema {
@@ -103,7 +103,7 @@ public class TestInferXmlSchema {
final DataType softwareDataType = schema.getDataType("software").get();
assertSame(RecordFieldType.RECORD, softwareDataType.getFieldType());
- assertTrue(softwareDataType instanceof RecordDataType);
+ assertInstanceOf(RecordDataType.class, softwareDataType);
final RecordSchema childSchema = ((RecordDataType) softwareDataType).getChildSchema();
assertSame(RecordFieldType.BOOLEAN, childSchema.getDataType("favorite").get().getFieldType());
diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/yaml/TestYamlTreeRowRecordReader.java b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/yaml/TestYamlTreeRowRecordReader.java
index 31dd370b93..4b42ff75e6 100644
--- a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/yaml/TestYamlTreeRowRecordReader.java
+++ b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/yaml/TestYamlTreeRowRecordReader.java
@@ -49,6 +49,8 @@ import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
+import java.sql.Date;
+import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -62,6 +64,7 @@ import java.util.stream.Collectors;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
@@ -117,16 +120,16 @@ class TestYamlTreeRowRecordReader {
assertEquals(2, fieldsArray.length);
final Object firstElement = fieldsArray[0];
- assertTrue(firstElement instanceof Record);
+ assertInstanceOf(Record.class, firstElement);
assertEquals("string", ((Record) firstElement).getAsString("type"));
final Object secondElement = fieldsArray[1];
- assertTrue(secondElement instanceof Record);
+ assertInstanceOf(Record.class, secondElement);
final Object[] typeArray = ((Record) secondElement).getAsArray("type");
assertEquals(1, typeArray.length);
final Object firstType = typeArray[0];
- assertTrue(firstType instanceof Record);
+ assertInstanceOf(Record.class, firstType);
final Record firstTypeRecord = (Record) firstType;
assertEquals("string", firstTypeRecord.getAsString("type"));
}
@@ -155,7 +158,7 @@ class TestYamlTreeRowRecordReader {
// child record should have a schema with "id" as the only field
final Object childObject = firstRecord.getValue("child");
- assertTrue(childObject instanceof Record);
+ assertInstanceOf(Record.class, childObject);
final Record firstChildRecord = (Record) childObject;
final RecordSchema firstChildSchema = firstChildRecord.getSchema();
@@ -177,7 +180,7 @@ class TestYamlTreeRowRecordReader {
// child record should have a schema with "name" as the only field
final Object secondChildObject = secondRecord.getValue("child");
- assertTrue(secondChildObject instanceof Record);
+ assertInstanceOf(Record.class, secondChildObject);
final Record secondChildRecord = (Record) secondChildObject;
final RecordSchema secondChildSchema = secondChildRecord.getSchema();
@@ -343,7 +346,7 @@ class TestYamlTreeRowRecordReader {
final Record record = reader.nextRecord(coerceTypes, false);
final Object value = record.getValue(dateField);
- assertTrue(value instanceof java.sql.Date, "With coerceTypes set to " + coerceTypes + ", value is not a Date");
+ assertInstanceOf(Date.class, value, "With coerceTypes set to " + coerceTypes + ", value is not a Date");
assertEquals(date, value.toString());
}
}
@@ -360,7 +363,7 @@ class TestYamlTreeRowRecordReader {
final Record record = reader.nextRecord(coerceTypes, false);
final Object value = record.getValue("timestamp");
- assertTrue(value instanceof java.sql.Timestamp, "With coerceTypes set to " + coerceTypes + ", value is not a Timestamp");
+ assertInstanceOf(Timestamp.class, value, "With coerceTypes set to " + coerceTypes + ", value is not a Timestamp");
}
}
}
@@ -406,7 +409,7 @@ class TestYamlTreeRowRecordReader {
RecordFieldType.DOUBLE, RecordFieldType.STRING, RecordFieldType.STRING, RecordFieldType.STRING, RecordFieldType.STRING, RecordFieldType.STRING);
final List<RecordField> fields = schema.getFields();
for (int i = 0; i < schema.getFields().size(); i++) {
- assertTrue(fields.get(i).getDataType() instanceof ChoiceDataType);
+ assertInstanceOf(ChoiceDataType.class, fields.get(i).getDataType());
final ChoiceDataType choiceDataType = (ChoiceDataType) fields.get(i).getDataType();
assertEquals(expectedTypes.get(i), choiceDataType.getPossibleSubTypes().get(0).getFieldType());
}
@@ -562,7 +565,7 @@ class TestYamlTreeRowRecordReader {
final Object[] firstRecordValues = reader.nextRecord().getValues();
final Object secondValue = firstRecordValues[1];
- assertTrue(secondValue instanceof Long);
+ assertInstanceOf(Long.class, secondValue);
assertEquals(832036744985577473L, secondValue);
final Object unicodeValue = firstRecordValues[2];
diff --git a/nifi-framework-bundle/nifi-framework/nifi-authorizer/src/test/java/org/apache/nifi/authorization/AuthorizerFactoryTest.java b/nifi-framework-bundle/nifi-framework/nifi-authorizer/src/test/java/org/apache/nifi/authorization/AuthorizerFactoryTest.java
index 888a3842b9..e3d52beea7 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-authorizer/src/test/java/org/apache/nifi/authorization/AuthorizerFactoryTest.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-authorizer/src/test/java/org/apache/nifi/authorization/AuthorizerFactoryTest.java
@@ -25,7 +25,9 @@ import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -263,7 +265,7 @@ public class AuthorizerFactoryTest {
Authorizer authorizer = AuthorizerFactory.installIntegrityChecks(mockAuthorizer);
authorizer.onConfigured(context);
- assertTrue(authorizer instanceof AuthorizationAuditor);
+ assertInstanceOf(AuthorizationAuditor.class, authorizer);
final AuthorizationRequest accessAttempt = new AuthorizationRequest.Builder()
.resource(new MockResource("resource1", "Resource 1"))
@@ -275,7 +277,7 @@ public class AuthorizerFactoryTest {
final AuthorizationResult accessAttemptResult = authorizer.authorize(accessAttempt);
- assertTrue(Result.Approved.equals(accessAttemptResult.getResult()));
+ assertEquals(Result.Approved, accessAttemptResult.getResult());
assertTrue(mockAuthorizer.isAudited(accessAttempt));
final AuthorizationRequest nonAccessAttempt = new AuthorizationRequest.Builder()
@@ -288,7 +290,7 @@ public class AuthorizerFactoryTest {
final AuthorizationResult nonAccessAttempResult = authorizer.authorize(nonAccessAttempt);
- assertTrue(Result.Approved.equals(nonAccessAttempResult.getResult()));
+ assertEquals(Result.Approved, nonAccessAttempResult.getResult());
assertFalse(mockAuthorizer.isAudited(nonAccessAttempt));
}
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-authorization-providers/src/test/java/org/apache/nifi/authorization/StandardManagedAuthorizerTest.java b/nifi-framework-bundle/nifi-framework/nifi-framework-authorization-providers/src/test/java/org/apache/nifi/authorization/StandardManagedAuthorizerTest.java
index d3a6855881..83c18e766a 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-authorization-providers/src/test/java/org/apache/nifi/authorization/StandardManagedAuthorizerTest.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-authorization-providers/src/test/java/org/apache/nifi/authorization/StandardManagedAuthorizerTest.java
@@ -29,7 +29,6 @@ import java.util.stream.Stream;
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.ArgumentMatchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
@@ -479,7 +478,7 @@ public class StandardManagedAuthorizerTest {
.build();
final StandardManagedAuthorizer managedAuthorizer = getStandardManagedAuthorizer(accessPolicyProvider);
- assertTrue(AuthorizationResult.denied().getResult().equals(managedAuthorizer.authorize(request).getResult()));
+ assertEquals(AuthorizationResult.denied().getResult(), managedAuthorizer.authorize(request).getResult());
}
@Test
@@ -525,7 +524,7 @@ public class StandardManagedAuthorizerTest {
.build();
final StandardManagedAuthorizer managedAuthorizer = getStandardManagedAuthorizer(accessPolicyProvider);
- assertTrue(AuthorizationResult.denied().getResult().equals(managedAuthorizer.authorize(request).getResult()));
+ assertEquals(AuthorizationResult.denied().getResult(), managedAuthorizer.authorize(request).getResult());
}
private StandardManagedAuthorizer getStandardManagedAuthorizer(final AccessPolicyProvider accessPolicyProvider) {
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-cluster-protocol/src/test/java/org/apache/nifi/cluster/protocol/jaxb/message/TestJaxbProtocolUtils.java b/nifi-framework-bundle/nifi-framework/nifi-framework-cluster-protocol/src/test/java/org/apache/nifi/cluster/protocol/jaxb/message/TestJaxbProtocolUtils.java
index fa3da9ad4e..b773071878 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-cluster-protocol/src/test/java/org/apache/nifi/cluster/protocol/jaxb/message/TestJaxbProtocolUtils.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-cluster-protocol/src/test/java/org/apache/nifi/cluster/protocol/jaxb/message/TestJaxbProtocolUtils.java
@@ -48,6 +48,7 @@ import java.util.Map;
import java.util.stream.IntStream;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class TestJaxbProtocolUtils {
@@ -73,7 +74,7 @@ public class TestJaxbProtocolUtils {
JaxbProtocolUtils.JAXB_CONTEXT.createMarshaller().marshal(msg, baos);
final Object unmarshalled = JaxbProtocolUtils.JAXB_CONTEXT.createUnmarshaller().unmarshal(new ByteArrayInputStream(baos.toByteArray()));
- assertTrue(unmarshalled instanceof ConnectionResponseMessage);
+ assertInstanceOf(ConnectionResponseMessage.class, unmarshalled);
final ComponentRevisionSnapshot receivedSnapshot = msg.getConnectionResponse().getComponentRevisions();
final List<ComponentRevision> revisions = receivedSnapshot.getComponentRevisions();
@@ -94,7 +95,7 @@ public class TestJaxbProtocolUtils {
JaxbProtocolUtils.JAXB_CONTEXT.createMarshaller().marshal(msg, baos);
final Object unmarshalled = JaxbProtocolUtils.JAXB_CONTEXT.createUnmarshaller().unmarshal(new ByteArrayInputStream(baos.toByteArray()));
- assertTrue(unmarshalled instanceof NodeConnectionStatusRequestMessage);
+ assertInstanceOf(NodeConnectionStatusRequestMessage.class, unmarshalled);
}
@@ -109,7 +110,7 @@ public class TestJaxbProtocolUtils {
JaxbProtocolUtils.JAXB_CONTEXT.createMarshaller().marshal(msg, baos);
final Object unmarshalled = JaxbProtocolUtils.JAXB_CONTEXT.createUnmarshaller().unmarshal(new ByteArrayInputStream(baos.toByteArray()));
- assertTrue(unmarshalled instanceof NodeConnectionStatusResponseMessage);
+ assertInstanceOf(NodeConnectionStatusResponseMessage.class, unmarshalled);
final NodeConnectionStatusResponseMessage unmarshalledMsg = (NodeConnectionStatusResponseMessage) unmarshalled;
final NodeConnectionStatus unmarshalledStatus = unmarshalledMsg.getNodeConnectionStatus();
@@ -138,7 +139,7 @@ public class TestJaxbProtocolUtils {
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
JaxbProtocolUtils.JAXB_CONTEXT.createMarshaller().marshal(msg, baos);
final Object unmarshalled = JaxbProtocolUtils.JAXB_CONTEXT.createUnmarshaller().unmarshal(new ByteArrayInputStream(baos.toByteArray()));
- assertTrue(unmarshalled instanceof HeartbeatMessage);
+ assertInstanceOf(HeartbeatMessage.class, unmarshalled);
}
@Test
@@ -147,7 +148,7 @@ public class TestJaxbProtocolUtils {
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
JaxbProtocolUtils.JAXB_CONTEXT.createMarshaller().marshal(msg, baos);
final Object unmarshalled = JaxbProtocolUtils.JAXB_CONTEXT.createUnmarshaller().unmarshal(new ByteArrayInputStream(baos.toByteArray()));
- assertTrue(unmarshalled instanceof ClusterWorkloadRequestMessage);
+ assertInstanceOf(ClusterWorkloadRequestMessage.class, unmarshalled);
}
@Test
@@ -174,7 +175,7 @@ public class TestJaxbProtocolUtils {
// Un-marshall.
final Object unmarshalled = JaxbProtocolUtils.JAXB_CONTEXT.createUnmarshaller().unmarshal(new ByteArrayInputStream(baos.toByteArray()));
- assertTrue(unmarshalled instanceof ClusterWorkloadResponseMessage);
+ assertInstanceOf(ClusterWorkloadResponseMessage.class, unmarshalled);
// Assert result.
final ClusterWorkloadResponseMessage response = (ClusterWorkloadResponseMessage) unmarshalled;
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/test/java/org/apache/nifi/cluster/coordination/node/TestNodeClusterCoordinator.java b/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/test/java/org/apache/nifi/cluster/coordination/node/TestNodeClusterCoordinator.java
index 68a4b1f9f9..dd5b6fde6a 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/test/java/org/apache/nifi/cluster/coordination/node/TestNodeClusterCoordinator.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/test/java/org/apache/nifi/cluster/coordination/node/TestNodeClusterCoordinator.java
@@ -45,7 +45,6 @@ import org.mockito.Mockito;
import java.io.IOException;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@@ -55,7 +54,9 @@ import java.util.Set;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
@@ -121,7 +122,7 @@ public class TestNodeClusterCoordinator {
final NodeIdentifier requestedNodeId = createNodeId(6);
final ProtocolMessage protocolResponse = requestConnection(requestedNodeId, coordinator);
assertNotNull(protocolResponse);
- assertTrue(protocolResponse instanceof ConnectionResponseMessage);
+ assertInstanceOf(ConnectionResponseMessage.class, protocolResponse);
final ConnectionResponse response = ((ConnectionResponseMessage) protocolResponse).getConnectionResponse();
assertNotNull(response);
@@ -166,7 +167,7 @@ public class TestNodeClusterCoordinator {
final ProtocolMessage protocolResponse = coordinator.handle(requestMsg, Collections.emptySet());
assertNotNull(protocolResponse);
- assertTrue(protocolResponse instanceof ConnectionResponseMessage);
+ assertInstanceOf(ConnectionResponseMessage.class, protocolResponse);
final ConnectionResponse response = ((ConnectionResponseMessage) protocolResponse).getConnectionResponse();
assertNotNull(response);
@@ -214,8 +215,8 @@ public class TestNodeClusterCoordinator {
final StandardDataFlow df = msg.getDataFlow();
assertNotNull(df);
- assertTrue(Arrays.equals(dataFlow.getFlow(), df.getFlow()));
- assertTrue(Arrays.equals(dataFlow.getSnippets(), df.getSnippets()));
+ assertArrayEquals(dataFlow.getFlow(), df.getFlow());
+ assertArrayEquals(dataFlow.getSnippets(), df.getSnippets());
}
@Test
@@ -429,7 +430,7 @@ public class TestNodeClusterCoordinator {
final ProtocolMessage response = coordinator.handle(crm, Collections.emptySet());
assertNotNull(response);
- assertTrue(response instanceof ConnectionResponseMessage);
+ assertInstanceOf(ConnectionResponseMessage.class, response);
final ConnectionResponseMessage responseMessage = (ConnectionResponseMessage) response;
final NodeIdentifier resolvedNodeId = responseMessage.getConnectionResponse().getNodeIdentifier();
assertEquals(id1, resolvedNodeId);
@@ -440,7 +441,7 @@ public class TestNodeClusterCoordinator {
final ProtocolMessage conflictingResponse = coordinator.handle(crm2, Collections.emptySet());
assertNotNull(conflictingResponse);
- assertTrue(conflictingResponse instanceof ConnectionResponseMessage);
+ assertInstanceOf(ConnectionResponseMessage.class, conflictingResponse);
final ConnectionResponseMessage conflictingResponseMessage = (ConnectionResponseMessage) conflictingResponse;
final NodeIdentifier conflictingNodeId = conflictingResponseMessage.getConnectionResponse().getNodeIdentifier();
assertEquals(id1.getId(), conflictingNodeId.getId());
@@ -463,7 +464,7 @@ public class TestNodeClusterCoordinator {
final ProtocolMessage response = coordinator.handle(crm, Collections.emptySet());
assertNotNull(response);
- assertTrue(response instanceof ConnectionResponseMessage);
+ assertInstanceOf(ConnectionResponseMessage.class, response);
final ConnectionResponseMessage responseMessage = (ConnectionResponseMessage) response;
final NodeIdentifier resolvedNodeId = responseMessage.getConnectionResponse().getNodeIdentifier();
assertEquals(id1, resolvedNodeId);
@@ -476,7 +477,7 @@ public class TestNodeClusterCoordinator {
final ProtocolMessage conflictingResponse = coordinator.handle(crm2, Collections.emptySet());
assertNotNull(conflictingResponse);
- assertTrue(conflictingResponse instanceof ConnectionResponseMessage);
+ assertInstanceOf(ConnectionResponseMessage.class, conflictingResponse);
final ConnectionResponseMessage conflictingResponseMessage = (ConnectionResponseMessage) conflictingResponse;
final NodeIdentifier conflictingNodeId = conflictingResponseMessage.getConnectionResponse().getNodeIdentifier();
assertEquals(id1.getId(), conflictingNodeId.getId());
diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/test/java/org/apache/nifi/controller/service/TestStandardControllerServiceInvocationHandler.java b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/test/java/org/apache/nifi/controller/service/TestStandardControllerServiceInvocationHandler.java
index 77614ecd24..57cdf2fc41 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/test/java/org/apache/nifi/controller/service/TestStandardControllerServiceInvocationHandler.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/test/java/org/apache/nifi/controller/service/TestStandardControllerServiceInvocationHandler.java
@@ -31,6 +31,7 @@ import java.net.URLClassLoader;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -155,7 +156,7 @@ public class TestStandardControllerServiceInvocationHandler {
BaseControllerService nextLevel = getNextLevel();
for (int i = 0; i < 5; i++) {
assertEquals(level + i + 1, nextLevel.getLevel());
- assertTrue(nextLevel instanceof TestService);
+ assertInstanceOf(TestService.class, nextLevel);
assertFalse(Proxy.isProxyClass(nextLevel.getClass()));
nextLevel = nextLevel.getNextLevel();
@@ -164,7 +165,7 @@ public class TestStandardControllerServiceInvocationHandler {
@Override
public void assertNotProxied(final BaseControllerService service) {
- assertTrue(service instanceof TestService);
+ assertInstanceOf(TestService.class, service);
assertFalse(Proxy.isProxyClass(service.getClass()));
}
}
diff --git a/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/test/java/org/apache/nifi/nar/LoadNativeLibAspectTest.java b/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/test/java/org/apache/nifi/nar/LoadNativeLibAspectTest.java
index 0a9e6d8780..20cbdda001 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/test/java/org/apache/nifi/nar/LoadNativeLibAspectTest.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/test/java/org/apache/nifi/nar/LoadNativeLibAspectTest.java
@@ -27,6 +27,7 @@ import java.nio.file.Paths;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;
@@ -107,7 +108,7 @@ public class LoadNativeLibAspectTest {
assertNotNull(args);
assertEquals(1, args.length);
assertNotNull(args[0]);
- assertTrue(args[0] instanceof String);
+ assertInstanceOf(String.class, args[0]);
String tempLibFilePathStr = (String) args[0];
Path tempLibFilePath = Paths.get(tempLibFilePathStr);
diff --git a/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/test/java/org/apache/nifi/remote/protocol/http/TestHttpFlowFileServerProtocol.java b/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/test/java/org/apache/nifi/remote/protocol/http/TestHttpFlowFileServerProtocol.java
index 356cd4265c..5ef549eebf 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/test/java/org/apache/nifi/remote/protocol/http/TestHttpFlowFileServerProtocol.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/test/java/org/apache/nifi/remote/protocol/http/TestHttpFlowFileServerProtocol.java
@@ -70,6 +70,7 @@ import java.util.stream.IntStream;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
@@ -223,7 +224,7 @@ public class TestHttpFlowFileServerProtocol {
assertTrue(serverProtocol.isHandshakeSuccessful());
final FlowFileCodec negotiatedCoded = serverProtocol.negotiateCodec(peer);
- assertTrue(negotiatedCoded instanceof StandardFlowFileCodec);
+ assertInstanceOf(StandardFlowFileCodec.class, negotiatedCoded);
assertEquals(negotiatedCoded, serverProtocol.getPreNegotiatedCodec());
assertEquals(1234, serverProtocol.getRequestExpiration());
diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/authorization/StandardAuthorizableLookupTest.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/authorization/StandardAuthorizableLookupTest.java
index 5576cdec03..319b4aab6e 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/authorization/StandardAuthorizableLookupTest.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/authorization/StandardAuthorizableLookupTest.java
@@ -29,7 +29,7 @@ import org.apache.nifi.web.controller.ControllerFacade;
import org.apache.nifi.web.dao.ProcessorDAO;
import org.junit.jupiter.api.Test;
-import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -52,26 +52,26 @@ public class StandardAuthorizableLookupTest {
lookup.setControllerFacade(controllerFacade);
Authorizable authorizable = lookup.getAuthorizableFromResource("/processors/id");
- assertTrue(authorizable instanceof ProcessorNode);
+ assertInstanceOf(ProcessorNode.class, authorizable);
authorizable = lookup.getAuthorizableFromResource("/policies/processors/id");
- assertTrue(authorizable instanceof AccessPolicyAuthorizable);
- assertTrue(((AccessPolicyAuthorizable) authorizable).getBaseAuthorizable() instanceof ProcessorNode);
+ assertInstanceOf(AccessPolicyAuthorizable.class, authorizable);
+ assertInstanceOf(ProcessorNode.class, ((AccessPolicyAuthorizable) authorizable).getBaseAuthorizable());
authorizable = lookup.getAuthorizableFromResource("/data/processors/id");
- assertTrue(authorizable instanceof DataAuthorizable);
- assertTrue(((DataAuthorizable) authorizable).getBaseAuthorizable() instanceof ProcessorNode);
+ assertInstanceOf(DataAuthorizable.class, authorizable);
+ assertInstanceOf(ProcessorNode.class, ((DataAuthorizable) authorizable).getBaseAuthorizable());
authorizable = lookup.getAuthorizableFromResource("/data-transfer/processors/id");
- assertTrue(authorizable instanceof DataTransferAuthorizable);
- assertTrue(((DataTransferAuthorizable) authorizable).getBaseAuthorizable() instanceof ProcessorNode);
+ assertInstanceOf(DataTransferAuthorizable.class, authorizable);
+ assertInstanceOf(ProcessorNode.class, ((DataTransferAuthorizable) authorizable).getBaseAuthorizable());
authorizable = lookup.getAuthorizableFromResource("/provenance-data/processors/id");
- assertTrue(authorizable instanceof ProvenanceDataAuthorizable);
- assertTrue(((ProvenanceDataAuthorizable) authorizable).getBaseAuthorizable() instanceof ProcessorNode);
+ assertInstanceOf(ProvenanceDataAuthorizable.class, authorizable);
+ assertInstanceOf(ProcessorNode.class, ((ProvenanceDataAuthorizable) authorizable).getBaseAuthorizable());
authorizable = lookup.getAuthorizableFromResource("/operation/processors/id");
- assertTrue(authorizable instanceof OperationAuthorizable);
- assertTrue(((OperationAuthorizable) authorizable).getBaseAuthorizable() instanceof ProcessorNode);
+ assertInstanceOf(OperationAuthorizable.class, authorizable);
+ assertInstanceOf(ProcessorNode.class, ((OperationAuthorizable) authorizable).getBaseAuthorizable());
}
}
diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/api/TestDataTransferResource.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/api/TestDataTransferResource.java
index af1eec3225..ce4dfb17d7 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/api/TestDataTransferResource.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/api/TestDataTransferResource.java
@@ -48,7 +48,7 @@ import java.net.URISyntaxException;
import java.net.URL;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doAnswer;
@@ -344,7 +344,7 @@ public class TestDataTransferResource {
final Object entity = response.getEntity();
assertEquals(202, response.getStatus());
- assertTrue(entity instanceof StreamingOutput);
+ assertInstanceOf(StreamingOutput.class, entity);
}
@Test
diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/api/TestFlowResource.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/api/TestFlowResource.java
index f7e0a45dbf..e447f6b81e 100644
--- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/api/TestFlowResource.java
+++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/api/TestFlowResource.java
@@ -65,6 +65,7 @@ import java.util.stream.Collectors;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -307,7 +308,7 @@ public class TestFlowResource {
SAMPLE_REGISTRY_ID, SAMPLE_BRANCH_ID_A, SAMPLE_BUCKET_ID_A, SAMPLE_FLOW_ID_A, "1", SAMPLE_BRANCH_ID_B, SAMPLE_BUCKET_ID_B, SAMPLE_FLOW_ID_B, "2", 0, 0);
assertNotNull(response);
assertEquals(MediaType.valueOf(MediaType.APPLICATION_JSON), response.getMediaType());
- assertTrue(FlowComparisonEntity.class.isInstance(response.getEntity()));
+ assertInstanceOf(FlowComparisonEntity.class, response.getEntity());
final FlowComparisonEntity entity = (FlowComparisonEntity) response.getEntity();
final List<DifferenceDTO> differences = entity.getComponentDifferences().stream().map(ComponentDifferenceDTO::getDifferences).flatMap(Collection::stream).collect(Collectors.toList());
@@ -324,7 +325,7 @@ public class TestFlowResource {
assertNotNull(response);
assertEquals(MediaType.valueOf(MediaType.APPLICATION_JSON), response.getMediaType());
- assertTrue(FlowComparisonEntity.class.isInstance(response.getEntity()));
+ assertInstanceOf(FlowComparisonEntity.class, response.getEntity());
final FlowComparisonEntity entity = (FlowComparisonEntity) response.getEntity();
final List<DifferenceDTO> differences = entity.getComponentDifferences().stream().map(ComponentDifferenceDTO::getDifferences).flatMap(Collection::stream).collect(Collectors.toList());
@@ -343,7 +344,7 @@ public class TestFlowResource {
assertNotNull(response);
assertEquals(MediaType.valueOf(MediaType.APPLICATION_JSON), response.getMediaType());
- assertTrue(FlowComparisonEntity.class.isInstance(response.getEntity()));
+ assertInstanceOf(FlowComparisonEntity.class, response.getEntity());
final FlowComparisonEntity entity = (FlowComparisonEntity) response.getEntity();
final List<DifferenceDTO> differences = entity.getComponentDifferences().stream().map(ComponentDifferenceDTO::getDifferences).flatMap(Collection::stream).collect(Collectors.toList());
@@ -363,7 +364,7 @@ public class TestFlowResource {
assertNotNull(response);
assertEquals(MediaType.valueOf(MediaType.APPLICATION_JSON), response.getMediaType());
- assertTrue(FlowComparisonEntity.class.isInstance(response.getEntity()));
+ assertInstanceOf(FlowComparisonEntity.class, response.getEntity());
final FlowComparisonEntity entity = (FlowComparisonEntity) response.getEntity();
final List<DifferenceDTO> differences = entity.getComponentDifferences().stream().map(ComponentDifferenceDTO::getDifferences).flatMap(Collection::stream).collect(Collectors.toList());
@@ -383,7 +384,7 @@ public class TestFlowResource {
assertNotNull(response);
assertEquals(MediaType.valueOf(MediaType.APPLICATION_JSON), response.getMediaType());
- assertTrue(FlowComparisonEntity.class.isInstance(response.getEntity()));
+ assertInstanceOf(FlowComparisonEntity.class, response.getEntity());
final FlowComparisonEntity entity = (FlowComparisonEntity) response.getEntity();
final List<DifferenceDTO> differences = entity.getComponentDifferences().stream().map(ComponentDifferenceDTO::getDifferences).flatMap(Collection::stream).collect(Collectors.toList());
diff --git a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/test/java/org/apache/nifi/registry/serialization/TestFlowContentSerializer.java b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/test/java/org/apache/nifi/registry/serialization/TestFlowContentSerializer.java
index 9ad2f8ee99..a53ba13f43 100644
--- a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/test/java/org/apache/nifi/registry/serialization/TestFlowContentSerializer.java
+++ b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/test/java/org/apache/nifi/registry/serialization/TestFlowContentSerializer.java
@@ -70,7 +70,7 @@ public class TestFlowContentSerializer {
// make sure we can read the version from the input stream and it should be the current version
final Integer version = serializer.readDataModelVersion(in);
assertEquals(serializer.getCurrentDataModelVersion(), version);
- assertEquals(false, serializer.isProcessGroupVersion(version));
+ assertFalse(serializer.isProcessGroupVersion(version));
// make sure we can deserialize back to FlowContent
final FlowContent deserializedFlowContent = serializer.deserializeFlowContent(version, in);
diff --git a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/test/java/org/apache/nifi/registry/service/TestRegistryService.java b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/test/java/org/apache/nifi/registry/service/TestRegistryService.java
index 7cbd856d47..0635c671c4 100644
--- a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/test/java/org/apache/nifi/registry/service/TestRegistryService.java
+++ b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/test/java/org/apache/nifi/registry/service/TestRegistryService.java
@@ -1359,7 +1359,7 @@ public class TestRegistryService {
.filter(p -> p.getComponentId().equals("ID-pg1")).findFirst();
assertTrue(removedComponent.isPresent());
- assertTrue(removedComponent.get().getDifferences().iterator().next().getDifferenceType().equals("COMPONENT_REMOVED"));
+ assertEquals("COMPONENT_REMOVED", removedComponent.get().getDifferences().iterator().next().getDifferenceType());
}
@Test
diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/BucketsIT.java b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/BucketsIT.java
index 1ecf2c9c9c..d22f0b1a9a 100644
--- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/BucketsIT.java
+++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/BucketsIT.java
@@ -31,6 +31,7 @@ import java.util.UUID;
import static org.apache.nifi.registry.web.api.IntegrationTestUtils.assertBucketsEqual;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -93,7 +94,7 @@ public class BucketsIT extends UnsecuredITBase {
// Then: the pre-populated list of buckets is returned
JSONAssert.assertEquals(expected, bucketsJson, false);
- assertTrue(!bucketsJson.contains("null")); // JSON serialization from the server should not include null fields, such as "versionedFlows": null
+ assertFalse(bucketsJson.contains("null")); // JSON serialization from the server should not include null fields, such as "versionedFlows": null
}
@Test
diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/SecureNiFiRegistryClientIT.java b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/SecureNiFiRegistryClientIT.java
index 430f0a5e7e..431f6bbab5 100644
--- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/SecureNiFiRegistryClientIT.java
+++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/SecureNiFiRegistryClientIT.java
@@ -46,8 +46,8 @@ import java.io.IOException;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
@ExtendWith(SpringExtension.class)
@@ -134,35 +134,35 @@ public class SecureNiFiRegistryClientIT extends IntegrationTestBase {
proxiedFlowClient.get("1");
fail("Shouldn't have been able to retrieve flow");
} catch (NiFiRegistryException e) {
- assertTrue(e.getCause() instanceof ForbiddenException);
+ assertInstanceOf(ForbiddenException.class, e.getCause());
}
try {
proxiedFlowSnapshotClient.getLatest("1");
fail("Shouldn't have been able to retrieve flow");
} catch (NiFiRegistryException e) {
- assertTrue(e.getCause() instanceof ForbiddenException);
+ assertInstanceOf(ForbiddenException.class, e.getCause());
}
try {
proxiedFlowSnapshotClient.getLatestMetadata("1");
fail("Shouldn't have been able to retrieve flow");
} catch (NiFiRegistryException e) {
- assertTrue(e.getCause() instanceof ForbiddenException);
+ assertInstanceOf(ForbiddenException.class, e.getCause());
}
try {
proxiedFlowSnapshotClient.get("1", 1);
fail("Shouldn't have been able to retrieve flow");
} catch (NiFiRegistryException e) {
- assertTrue(e.getCause() instanceof ForbiddenException);
+ assertInstanceOf(ForbiddenException.class, e.getCause());
}
try {
proxiedFlowSnapshotClient.getSnapshotMetadata("1");
fail("Shouldn't have been able to retrieve flow");
} catch (NiFiRegistryException e) {
- assertTrue(e.getCause() instanceof ForbiddenException);
+ assertInstanceOf(ForbiddenException.class, e.getCause());
}
}
diff --git a/nifi-system-tests/nifi-stateless-system-test-suite/src/test/java/org/apache/nifi/stateless/basics/RollbackOnExceptionIT.java b/nifi-system-tests/nifi-stateless-system-test-suite/src/test/java/org/apache/nifi/stateless/basics/RollbackOnExceptionIT.java
index 8105d8a3b8..59fc9d7004 100644
--- a/nifi-system-tests/nifi-stateless-system-test-suite/src/test/java/org/apache/nifi/stateless/basics/RollbackOnExceptionIT.java
+++ b/nifi-system-tests/nifi-stateless-system-test-suite/src/test/java/org/apache/nifi/stateless/basics/RollbackOnExceptionIT.java
@@ -33,7 +33,7 @@ import java.io.IOException;
import java.util.Collections;
import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
public class RollbackOnExceptionIT extends StatelessSystemIT {
private static final String EXCEPTION_TEXT = "Intentional Exception to verify behavior in RollbackOnExceptionIT";
@@ -54,7 +54,7 @@ public class RollbackOnExceptionIT extends StatelessSystemIT {
final DataflowTrigger trigger = dataflow.trigger();
final TriggerResult result = trigger.getResult();
assertFalse(result.isSuccessful());
- assertTrue(result.getFailureCause().get() instanceof ProcessException);
+ assertInstanceOf(ProcessException.class, result.getFailureCause().get());
// Wait for dataflow to be purged
while (dataflow.isFlowFileQueued()) {
@@ -79,7 +79,7 @@ public class RollbackOnExceptionIT extends StatelessSystemIT {
final DataflowTrigger trigger = dataflow.trigger();
final TriggerResult result = trigger.getResult();
assertFalse(result.isSuccessful());
- assertTrue(result.getFailureCause().get() instanceof FailurePortEncounteredException);
+ assertInstanceOf(FailurePortEncounteredException.class, result.getFailureCause().get());
assertFalse(dataflow.isFlowFileQueued());
}
diff --git a/pmd-ruleset.xml b/pmd-ruleset.xml
index 116f149709..e263ae1518 100644
--- a/pmd-ruleset.xml
+++ b/pmd-ruleset.xml
@@ -36,6 +36,7 @@ under the License.
<rule ref="category/java/bestpractices.xml/AvoidReassigningCatchVariables" />
<rule ref="category/java/bestpractices.xml/PrimitiveWrapperInstantiation" />
+ <rule ref="category/java/bestpractices.xml/SimplifiableTestAssertion" />
<rule ref="category/java/bestpractices.xml/UnusedPrivateField" />
<rule ref="category/java/bestpractices.xml/UnnecessaryVarargsArrayCreation" />
<rule ref="category/java/bestpractices.xml/UnusedLocalVariable" />