dan-s1 commented on code in PR #6823:
URL: https://github.com/apache/nifi/pull/6823#discussion_r1062979166


##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/status/analytics/TestConnectionStatusAnalytics.java:
##########
@@ -151,7 +148,7 @@ public void testInvalidModelNaNScore() {
         ConnectionStatusAnalytics connectionStatusAnalytics = 
getConnectionStatusAnalytics(modelMap);
         Long countTime = 
connectionStatusAnalytics.getTimeToCountBackpressureMillis(connection, 
flowFileEvent);
         assertNotNull(countTime);
-        assert (countTime == -1);
+        assertEquals(-1, countTime);

Review Comment:
   In all other instances you cast countTime with (long). If you need a cast 
then it should be done here also. If you do not need a cast then the cases 
should not need it either.



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/test/java/org/apache/nifi/nar/AbstractNativeLibHandlingClassLoaderTest.java:
##########
@@ -61,13 +64,12 @@ public class AbstractNativeLibHandlingClassLoaderTest {
     private boolean isOsMaxOsx;
     private boolean isOsLinux;
 
-    @Before
+    @BeforeEach
     public void setUp() throws Exception {
-        initMocks(this);
         tempDirectory = 
Files.createTempDirectory(this.getClass().getSimpleName());

Review Comment:
   Shouldn't Junit 5 `@TempDir` be used for this?



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/html/XmlValidator.java:
##########
@@ -36,19 +37,15 @@ public class XmlValidator {
      */
     public static void assertXmlValid(String xml) {
         final String html = xml.replace(DOCTYPE, EMPTY);
-        try {
-            final DocumentProvider provider = new StandardDocumentProvider();
-            provider.parse(new 
ByteArrayInputStream(html.getBytes(StandardCharsets.UTF_8)));
-        } catch (final ProcessingException e) {
-            Assert.fail(e.getMessage());
-        }
+        final DocumentProvider provider = new StandardDocumentProvider();
+        provider.parse(new 
ByteArrayInputStream(html.getBytes(StandardCharsets.UTF_8)));

Review Comment:
   Wouldn't assertDoesNotThrow be more appropriate:
   
   ```
   final DocumentProvider provider = new StandardDocumentProvider();
   assertDoesNotThrow(() -> provider.parse(new 
ByteArrayInputStream(html.getBytes(StandardCharsets.UTF_8))));
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to