You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2021/09/13 20:36:20 UTC

[GitHub] [nifi] exceptionfactory commented on a change in pull request #5350: NIFI-9085 through NIFI-9095 (JUnit refactor of multiple modules)

exceptionfactory commented on a change in pull request #5350:
URL: https://github.com/apache/nifi/pull/5350#discussion_r707659758



##########
File path: nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/kinesis/stream/record/TestKinesisRecordProcessorRecord.java
##########
@@ -236,7 +236,7 @@ public void testProcessPoisonPillRecordButNoRawOutputWithCheckpoint() throws Shu
         session.assertTransferCount(ConsumeKinesisStream.REL_PARSE_FAILURE, 0);
 
         // check the "poison pill" record was retried a 2nd time
-        assertNull(verify(kinesisRecord, times(2)).getData());
+        Assertions.assertNull(verify(kinesisRecord, times(2)).getData());

Review comment:
       Change to use static imports.

##########
File path: nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/lambda/ITPutLambda.java
##########
@@ -108,22 +105,22 @@ public void testIntegrationClientErrorBadMessageBody() throws Exception {
         runner.assertAllFlowFilesTransferred(PutLambda.REL_FAILURE, 1);
         final List<MockFlowFile> ffs = runner.getFlowFilesForRelationship(PutLambda.REL_FAILURE);
         final MockFlowFile out = ffs.iterator().next();
-        assertNull("Function error should be null since there is exception"
-            + out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_FUNCTION_ERROR), out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_FUNCTION_ERROR));
-        assertNull("log should not be null", out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_LOG));
-        assertEquals("Status should be equal", null,out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_STATUS_CODE));
-        assertEquals("exception error code should be equal", "InvalidRequestContentException",out.getAttribute(PutLambda.AWS_LAMBDA_EXCEPTION_ERROR_CODE));
-        assertEquals("exception exception error type should be equal", "Client",out.getAttribute(PutLambda.AWS_LAMBDA_EXCEPTION_ERROR_TYPE));
-        assertEquals("exception exception error code should be equal", "400",out.getAttribute(PutLambda.AWS_LAMBDA_EXCEPTION_STATUS_CODE));
-        assertTrue("exception exception error message should be start with",out.getAttribute(PutLambda.AWS_LAMBDA_EXCEPTION_MESSAGE)
-               .startsWith("Could not parse request body into json: Unrecognized token 'badbod': was expecting ('true', 'false' or 'null')"));
+        Assertions.assertNull(out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_FUNCTION_ERROR), "Function error should be null since there is exception"
+            + out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_FUNCTION_ERROR));
+        Assertions.assertNull(out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_LOG), "log should not be null");
+        Assertions.assertEquals(null,out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_STATUS_CODE), "Status should be equal");
+        Assertions.assertEquals("InvalidRequestContentException",out.getAttribute(PutLambda.AWS_LAMBDA_EXCEPTION_ERROR_CODE), "exception error code should be equal");
+        Assertions.assertEquals("Client",out.getAttribute(PutLambda.AWS_LAMBDA_EXCEPTION_ERROR_TYPE), "exception exception error type should be equal");
+        Assertions.assertEquals("400",out.getAttribute(PutLambda.AWS_LAMBDA_EXCEPTION_STATUS_CODE), "exception exception error code should be equal");
+        Assertions.assertTrue(out.getAttribute(PutLambda.AWS_LAMBDA_EXCEPTION_MESSAGE)
+               .startsWith("Could not parse request body into json: Unrecognized token 'badbod': was expecting ('true', 'false' or 'null')"), "exception exception error message should be start with");

Review comment:
       Change to use static imports.

##########
File path: nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/lambda/ITPutLambda.java
##########
@@ -86,16 +83,16 @@ public void testIntegrationSuccess() throws Exception {
 
         final List<MockFlowFile> ffs = runner.getFlowFilesForRelationship(PutLambda.REL_SUCCESS);
         final MockFlowFile out = ffs.iterator().next();
-        assertNull("Function error should be null " + out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_FUNCTION_ERROR), out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_FUNCTION_ERROR));
-        assertNotNull("log should not be null", out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_LOG));
-        assertEquals("Status should be equal", "200",out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_STATUS_CODE));
+        Assertions.assertNull(out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_FUNCTION_ERROR), "Function error should be null " + out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_FUNCTION_ERROR));
+        Assertions.assertNotNull(out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_LOG), "log should not be null");
+        Assertions.assertEquals("200",out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_STATUS_CODE), "Status should be equal");

Review comment:
       Change to use static imports.

##########
File path: nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/kinesis/stream/record/TestKinesisRecordProcessorRaw.java
##########
@@ -208,10 +208,10 @@ public void testProcessPoisonPillRecordWithCheckpoint() throws ShutdownException
         assertFlowFile(flowFiles.get(1), null, "partition-3", "3", "record-3");
 
         // check the "poison pill" record was retried a 2nd time
-        assertNull(verify(kinesisRecord, times(2)).getPartitionKey());
-        assertNull(verify(kinesisRecord, times(2)).getSequenceNumber());
-        assertNull(verify(kinesisRecord, times(2)).getApproximateArrivalTimestamp());
-        assertNull(verify(kinesisRecord, times(2)).getData());
+        Assertions.assertNull(verify(kinesisRecord, times(2)).getPartitionKey());
+        Assertions.assertNull(verify(kinesisRecord, times(2)).getSequenceNumber());
+        Assertions.assertNull(verify(kinesisRecord, times(2)).getApproximateArrivalTimestamp());
+        Assertions.assertNull(verify(kinesisRecord, times(2)).getData());

Review comment:
       This should be changed to use static imports.

##########
File path: nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/lambda/ITPutLambda.java
##########
@@ -86,16 +83,16 @@ public void testIntegrationSuccess() throws Exception {
 
         final List<MockFlowFile> ffs = runner.getFlowFilesForRelationship(PutLambda.REL_SUCCESS);
         final MockFlowFile out = ffs.iterator().next();
-        assertNull("Function error should be null " + out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_FUNCTION_ERROR), out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_FUNCTION_ERROR));
-        assertNotNull("log should not be null", out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_LOG));
-        assertEquals("Status should be equal", "200",out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_STATUS_CODE));
+        Assertions.assertNull(out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_FUNCTION_ERROR), "Function error should be null " + out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_FUNCTION_ERROR));
+        Assertions.assertNotNull(out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_LOG), "log should not be null");
+        Assertions.assertEquals("200",out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_STATUS_CODE), "Status should be equal");
     }
 
     /**
      * Comment out ignore for integration tests (requires creds files)
      */
     @Test
-    @Ignore
+    @Disabled

Review comment:
       Annotation can be removed from integration test class.

##########
File path: nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/lambda/ITPutLambda.java
##########
@@ -136,10 +133,10 @@ public void testIntegrationFailedBadStreamName() throws Exception {
         runner.assertAllFlowFilesTransferred(PutLambda.REL_FAILURE, 1);
         final List<MockFlowFile> ffs = runner.getFlowFilesForRelationship(PutLambda.REL_FAILURE);
         final MockFlowFile out = ffs.iterator().next();
-        assertNull("Function error should be null since there is exception"
-            + out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_FUNCTION_ERROR), out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_FUNCTION_ERROR));
-        assertNull("log should not be null", out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_LOG));
-        assertEquals("Status should be equal", null,out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_STATUS_CODE));
+        Assertions.assertNull(out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_FUNCTION_ERROR), "Function error should be null since there is exception"
+            + out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_FUNCTION_ERROR));
+        Assertions.assertNull(out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_LOG), "log should not be null");
+        Assertions.assertEquals(null,out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_STATUS_CODE), "Status should be equal");

Review comment:
       Replace with static imports.

##########
File path: nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/lambda/TestPutLambda.java
##########
@@ -91,7 +87,7 @@ public void testPutLambdaSimple() {
         ArgumentCaptor<InvokeRequest> captureRequest = ArgumentCaptor.forClass(InvokeRequest.class);
         Mockito.verify(mockLambdaClient, Mockito.times(1)).invoke(captureRequest.capture());
         InvokeRequest request = captureRequest.getValue();
-        assertEquals("test-function", request.getFunctionName());
+        Assertions.assertEquals("test-function", request.getFunctionName());

Review comment:
       Replace with static imports.

##########
File path: nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/lambda/ITPutLambda.java
##########
@@ -72,7 +69,7 @@ public void testSizeGreaterThan6MB() throws Exception {
      * Comment out ignore for integration tests (requires creds files)
      */
     @Test
-    @Ignore
+    @Disabled

Review comment:
       This annotation can be removed since this is an integration test class.

##########
File path: nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/lambda/ITPutLambda.java
##########
@@ -108,22 +105,22 @@ public void testIntegrationClientErrorBadMessageBody() throws Exception {
         runner.assertAllFlowFilesTransferred(PutLambda.REL_FAILURE, 1);
         final List<MockFlowFile> ffs = runner.getFlowFilesForRelationship(PutLambda.REL_FAILURE);
         final MockFlowFile out = ffs.iterator().next();
-        assertNull("Function error should be null since there is exception"
-            + out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_FUNCTION_ERROR), out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_FUNCTION_ERROR));
-        assertNull("log should not be null", out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_LOG));
-        assertEquals("Status should be equal", null,out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_STATUS_CODE));
-        assertEquals("exception error code should be equal", "InvalidRequestContentException",out.getAttribute(PutLambda.AWS_LAMBDA_EXCEPTION_ERROR_CODE));
-        assertEquals("exception exception error type should be equal", "Client",out.getAttribute(PutLambda.AWS_LAMBDA_EXCEPTION_ERROR_TYPE));
-        assertEquals("exception exception error code should be equal", "400",out.getAttribute(PutLambda.AWS_LAMBDA_EXCEPTION_STATUS_CODE));
-        assertTrue("exception exception error message should be start with",out.getAttribute(PutLambda.AWS_LAMBDA_EXCEPTION_MESSAGE)
-               .startsWith("Could not parse request body into json: Unrecognized token 'badbod': was expecting ('true', 'false' or 'null')"));
+        Assertions.assertNull(out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_FUNCTION_ERROR), "Function error should be null since there is exception"
+            + out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_FUNCTION_ERROR));
+        Assertions.assertNull(out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_LOG), "log should not be null");
+        Assertions.assertEquals(null,out.getAttribute(PutLambda.AWS_LAMBDA_RESULT_STATUS_CODE), "Status should be equal");
+        Assertions.assertEquals("InvalidRequestContentException",out.getAttribute(PutLambda.AWS_LAMBDA_EXCEPTION_ERROR_CODE), "exception error code should be equal");
+        Assertions.assertEquals("Client",out.getAttribute(PutLambda.AWS_LAMBDA_EXCEPTION_ERROR_TYPE), "exception exception error type should be equal");
+        Assertions.assertEquals("400",out.getAttribute(PutLambda.AWS_LAMBDA_EXCEPTION_STATUS_CODE), "exception exception error code should be equal");
+        Assertions.assertTrue(out.getAttribute(PutLambda.AWS_LAMBDA_EXCEPTION_MESSAGE)
+               .startsWith("Could not parse request body into json: Unrecognized token 'badbod': was expecting ('true', 'false' or 'null')"), "exception exception error message should be start with");
     }
 
     /**
      * Comment out ignore for integration tests (requires creds files)
      */
     @Test
-    @Ignore
+    @Disabled

Review comment:
       Annotation can be removed from integration test class.

##########
File path: nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/lambda/TestPutLambda.java
##########
@@ -125,7 +121,7 @@ public void testPutLambdaTooManyRequestsException() {
         runner.assertAllFlowFilesTransferred(PutLambda.REL_FAILURE, 1);
         final List<MockFlowFile> flowFiles = runner.getFlowFilesForRelationship(PutLambda.REL_FAILURE);
         final MockFlowFile ff0 = flowFiles.get(0);
-        assertTrue(ff0.isPenalized());
+        Assertions.assertTrue(ff0.isPenalized());

Review comment:
       Replace with static imports.

##########
File path: nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/s3/AbstractS3IT.java
##########
@@ -185,7 +185,7 @@ protected Path getResourcePath(String resourceName) {
         try {
             path = Paths.get(getClass().getResource(resourceName).toURI());
         } catch (URISyntaxException e) {
-           Assert.fail("Resource: " + resourceName + " does not exist" + e.getLocalizedMessage());
+           Assertions.fail("Resource: " + resourceName + " does not exist" + e.getLocalizedMessage());

Review comment:
       Replace with static imports.

##########
File path: nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/s3/AbstractS3IT.java
##########
@@ -146,7 +146,7 @@ public static void oneTimeTearDown() {
         }
 
         if (client.doesBucketExist(BUCKET_NAME)) {
-            Assert.fail("Incomplete teardown, subsequent tests might fail");
+            Assertions.fail("Incomplete teardown, subsequent tests might fail");

Review comment:
       Replace with static imports.

##########
File path: nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/s3/AbstractS3IT.java
##########
@@ -196,7 +196,7 @@ protected File getFileFromResourceName(String resourceName) {
         try {
             uri = this.getClass().getResource(resourceName).toURI();
         } catch (URISyntaxException e) {
-            Assert.fail("Cannot proceed without File : " + resourceName);
+            Assertions.fail("Cannot proceed without File : " + resourceName);

Review comment:
       Replace with static imports.

##########
File path: nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/kinesis/stream/record/TestKinesisRecordProcessorRecord.java
##########
@@ -294,10 +294,10 @@ public void testProcessUnparsableRecordWithRawOutputWithCheckpoint() throws Shut
         failureFlowFiles.get(0).assertAttributeExists("record.error.message");
 
         // check the invalid json record was *not* retried a 2nd time
-        assertNull(verify(kinesisRecord, times(1)).getPartitionKey());
-        assertNull(verify(kinesisRecord, times(1)).getSequenceNumber());
-        assertNull(verify(kinesisRecord, times(1)).getApproximateArrivalTimestamp());
-        assertNull(verify(kinesisRecord, times(2)).getData());
+        Assertions.assertNull(verify(kinesisRecord, times(1)).getPartitionKey());
+        Assertions.assertNull(verify(kinesisRecord, times(1)).getSequenceNumber());
+        Assertions.assertNull(verify(kinesisRecord, times(1)).getApproximateArrivalTimestamp());
+        Assertions.assertNull(verify(kinesisRecord, times(2)).getData());

Review comment:
       Change to use static imports.

##########
File path: nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/s3/ITPutS3Object.java
##########
@@ -115,7 +114,7 @@ public static void teardownClass() {
     public void testSimplePut() throws IOException {
         TestRunner runner = initTestRunner();
 
-        Assert.assertTrue(runner.setProperty("x-custom-prop", "hello").isValid());
+        Assertions.assertTrue(runner.setProperty("x-custom-prop", "hello").isValid());

Review comment:
       Replace with static imports throughout this class.




-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org