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/01 09:32:13 UTC

[GitHub] [nifi] MikeThomsen opened a new pull request #5362: NIFI-9149 to NIFI-9163 (JUnit 5 refactor)

MikeThomsen opened a new pull request #5362:
URL: https://github.com/apache/nifi/pull/5362


   <!--
     Licensed to the Apache Software Foundation (ASF) under one or more
     contributor license agreements.  See the NOTICE file distributed with
     this work for additional information regarding copyright ownership.
     The ASF licenses this file to You under the Apache License, Version 2.0
     (the "License"); you may not use this file except in compliance with
     the License.  You may obtain a copy of the License at
         http://www.apache.org/licenses/LICENSE-2.0
     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
   -->
   Thank you for submitting a contribution to Apache NiFi.
   
   Please provide a short description of the PR here:
   
   #### Description of PR
   
   _Enables X functionality; fixes bug NIFI-YYYY._
   
   In order to streamline the review of the contribution we ask you
   to ensure the following steps have been taken:
   
   ### For all changes:
   - [ ] Is there a JIRA ticket associated with this PR? Is it referenced 
        in the commit message?
   
   - [ ] Does your PR title start with **NIFI-XXXX** where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
   
   - [ ] Has your PR been rebased against the latest commit within the target branch (typically `main`)?
   
   - [ ] Is your initial contribution a single, squashed commit? _Additional commits in response to PR reviewer feedback should be made on this branch and pushed to allow change tracking. Do not `squash` or use `--force` when pushing to allow for clean monitoring of changes._
   
   ### For code changes:
   - [ ] Have you ensured that the full suite of tests is executed via `mvn -Pcontrib-check clean install` at the root `nifi` folder?
   - [ ] Have you written or updated unit tests to verify your changes?
   - [ ] Have you verified that the full build is successful on JDK 8?
   - [ ] Have you verified that the full build is successful on JDK 11?
   - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? 
   - [ ] If applicable, have you updated the `LICENSE` file, including the main `LICENSE` file under `nifi-assembly`?
   - [ ] If applicable, have you updated the `NOTICE` file, including the main `NOTICE` file found under `nifi-assembly`?
   - [ ] If adding new Properties, have you added `.displayName` in addition to .name (programmatic access) for each of the new properties?
   
   ### For documentation related changes:
   - [ ] Have you ensured that format looks appropriate for the output in which it is rendered?
   
   ### Note:
   Please ensure that once the PR is submitted, you check GitHub Actions CI for build issues and submit an update to your PR as soon as possible.
   


-- 
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



[GitHub] [nifi] MikeThomsen commented on pull request #5362: NIFI-9149 to NIFI-9163 (JUnit 5 refactor)

Posted by GitBox <gi...@apache.org>.
MikeThomsen commented on pull request #5362:
URL: https://github.com/apache/nifi/pull/5362#issuecomment-977861096


   Thansk!


-- 
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



[GitHub] [nifi] MikeThomsen commented on a change in pull request #5362: NIFI-9149 to NIFI-9163 (JUnit 5 refactor)

Posted by GitBox <gi...@apache.org>.
MikeThomsen commented on a change in pull request #5362:
URL: https://github.com/apache/nifi/pull/5362#discussion_r754572431



##########
File path: nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/test/java/org/apache/nifi/reporting/TestSiteToSiteMetricsReportingTask.java
##########
@@ -319,7 +302,7 @@ public void setup(ReportingContext reportContext) throws IOException {
                     when(client.createTransaction(Mockito.any(TransferDirection.class))).thenReturn(transaction);
                 } catch (final Exception e) {
                     e.printStackTrace();
-                    Assert.fail(e.toString());
+                    fail(e.toString());

Review comment:
       Changed the whole block to `assertDoesNotThrow` since that's the better fit.




-- 
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



[GitHub] [nifi] exceptionfactory commented on a change in pull request #5362: NIFI-9149 to NIFI-9163 (JUnit 5 refactor)

Posted by GitBox <gi...@apache.org>.
exceptionfactory commented on a change in pull request #5362:
URL: https://github.com/apache/nifi/pull/5362#discussion_r705764678



##########
File path: nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/test/java/org/apache/nifi/reporting/TestSiteToSiteProvenanceReportingTask.java
##########
@@ -692,7 +691,7 @@ public void setup(ReportingContext reportContext) throws IOException {
                     when(client.createTransaction(Mockito.any(TransferDirection.class))).thenReturn(transaction);
                 } catch (final Exception e) {
                     e.printStackTrace();
-                    Assert.fail(e.toString());
+                    fail(e.toString());

Review comment:
       This should be changed to `assertThrows`

##########
File path: nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/test/java/org/apache/nifi/reporting/TestSiteToSiteBulletinReportingTask.java
##########
@@ -198,7 +187,7 @@ public void setup(ReportingContext reportContext) throws IOException {
                     when(client.createTransaction(Mockito.any(TransferDirection.class))).thenReturn(transaction);
                 } catch (final Exception e) {
                     e.printStackTrace();
-                    Assert.fail(e.toString());
+                    fail(e.toString());

Review comment:
       This should be changed to `assertThrows`

##########
File path: nifi-nar-bundles/nifi-solr-bundle/nifi-solr-processors/src/test/java/org/apache/nifi/processors/solr/TestPutSolrContentStream.java
##########
@@ -636,9 +640,9 @@ protected SolrClient createSolrClient(ProcessContext context, String solrLocatio
                 when(mockSolrClient.request(any(SolrRequest.class),
                         eq(null))).thenThrow(throwable);
             } catch (SolrServerException e) {
-                Assert.fail(e.getMessage());
+                fail(e.getMessage());
             } catch (IOException e) {
-                Assert.fail(e.getMessage());
+                fail(e.getMessage());

Review comment:
       Should be changed to use `assertThrows`

##########
File path: nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/test/java/org/apache/nifi/reporting/sink/TestSiteToSiteReportingRecordSink.java
##########
@@ -164,7 +164,7 @@ protected SiteToSiteClient getClient() {
                 Mockito.when(client.createTransaction(Mockito.any(TransferDirection.class))).thenReturn(transaction);
             } catch (final Exception e) {
                 e.printStackTrace();
-                Assert.fail(e.toString());
+                fail(e.toString());

Review comment:
       Should be changed to use `assertThrows`

##########
File path: nifi-nar-bundles/nifi-solr-bundle/nifi-solr-processors/src/test/java/org/apache/nifi/processors/solr/TestPutSolrContentStream.java
##########
@@ -636,9 +640,9 @@ protected SolrClient createSolrClient(ProcessContext context, String solrLocatio
                 when(mockSolrClient.request(any(SolrRequest.class),
                         eq(null))).thenThrow(throwable);
             } catch (SolrServerException e) {
-                Assert.fail(e.getMessage());
+                fail(e.getMessage());

Review comment:
       Should be changed to use `assertThrows`

##########
File path: nifi-nar-bundles/nifi-solr-bundle/nifi-solr-processors/src/test/java/org/apache/nifi/processors/solr/TestPutSolrRecord.java
##########
@@ -721,7 +723,7 @@ protected SolrClient createSolrClient(ProcessContext context, String solrLocatio
                 when(mockSolrClient.request(any(SolrRequest.class),
                         eq(null))).thenThrow(throwable);
             } catch (SolrServerException|IOException e) {
-                Assert.fail(e.getMessage());
+                fail(e.getMessage());

Review comment:
       Should be changed to use `assertThrows`

##########
File path: nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/test/java/org/apache/nifi/reporting/TestSiteToSiteMetricsReportingTask.java
##########
@@ -319,7 +302,7 @@ public void setup(ReportingContext reportContext) throws IOException {
                     when(client.createTransaction(Mockito.any(TransferDirection.class))).thenReturn(transaction);
                 } catch (final Exception e) {
                     e.printStackTrace();
-                    Assert.fail(e.toString());
+                    fail(e.toString());

Review comment:
       This should be changed to `assertThrows`

##########
File path: nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/src/test/java/org/apache/nifi/websocket/util/HeaderMapExtractorTest.java
##########
@@ -51,15 +49,15 @@ public void testMapExtractor() {
         final Map<String, List<String>> actual = HeaderMapExtractor.getHeaderMap(attributes);
 
         // THEN
-        assertEquals(expected, actual);
+        Assertions.assertEquals(expected, actual);

Review comment:
       Usage should be changed to static imports.

##########
File path: nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/src/test/java/org/apache/nifi/websocket/jetty/TestJettyWebSocketClient.java
##########
@@ -33,9 +31,9 @@ public void testValidationRequiredProperties() throws Exception {
         final ControllerServiceTestContext context = new ControllerServiceTestContext(service, "service-id");
         service.initialize(context.getInitializationContext());
         final Collection<ValidationResult> results = service.validate(context.getValidationContext());
-        assertEquals(1, results.size());
+        Assertions.assertEquals(1, results.size());

Review comment:
       These references to `Assertions` should be changed to use static imports.

##########
File path: nifi-nar-bundles/nifi-websocket-bundle/nifi-websocket-services-jetty/src/test/java/org/apache/nifi/websocket/jetty/ITJettyWebSocketCommunication.java
##########
@@ -35,18 +37,17 @@
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicReference;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assume.assumeFalse;
+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.any;
 import static org.mockito.ArgumentMatchers.anyInt;
 import static org.mockito.ArgumentMatchers.anyString;
 import static org.mockito.Mockito.doAnswer;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 
-
+@DisabledOnOs(OS.WINDOWS)

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

##########
File path: nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/test/java/org/apache/nifi/reporting/TestSiteToSiteStatusReportingTask.java
##########
@@ -553,7 +548,7 @@ public void setup(ReportingContext reportContext) throws IOException {
                     when(client.createTransaction(Mockito.any(TransferDirection.class))).thenReturn(transaction);
                 } catch (final Exception e) {
                     e.printStackTrace();
-                    Assert.fail(e.toString());
+                    fail(e.toString());

Review comment:
       Should be changed to use `assertThrows`




-- 
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



[GitHub] [nifi] MikeThomsen commented on pull request #5362: NIFI-9149 to NIFI-9163 (JUnit 5 refactor)

Posted by GitBox <gi...@apache.org>.
MikeThomsen commented on pull request #5362:
URL: https://github.com/apache/nifi/pull/5362#issuecomment-975851574


   @exceptionfactory changes made and rebased.


-- 
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



[GitHub] [nifi] MikeThomsen commented on pull request #5362: NIFI-9149 to NIFI-9163 (JUnit 5 refactor)

Posted by GitBox <gi...@apache.org>.
MikeThomsen commented on pull request #5362:
URL: https://github.com/apache/nifi/pull/5362#issuecomment-976435471


   Looks like I accidentally collapsed some of your feedback items when I was copying the paths. I'll check and update.


-- 
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



[GitHub] [nifi] exceptionfactory closed pull request #5362: NIFI-9149 to NIFI-9163 (JUnit 5 refactor)

Posted by GitBox <gi...@apache.org>.
exceptionfactory closed pull request #5362:
URL: https://github.com/apache/nifi/pull/5362


   


-- 
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



[GitHub] [nifi] exceptionfactory commented on pull request #5362: NIFI-9149 to NIFI-9163 (JUnit 5 refactor)

Posted by GitBox <gi...@apache.org>.
exceptionfactory commented on pull request #5362:
URL: https://github.com/apache/nifi/pull/5362#issuecomment-976109353


   > @exceptionfactory changes made and rebased.
   
   Thanks for the updates @MikeThomsen, I noticed some of the updates, but there were a couple points where I still saw `fail()` as opposed to using `assertThrows()`, did your latest commit included all the changes you intended?


-- 
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



[GitHub] [nifi] MikeThomsen commented on pull request #5362: NIFI-9149 to NIFI-9163 (JUnit 5 refactor)

Posted by GitBox <gi...@apache.org>.
MikeThomsen commented on pull request #5362:
URL: https://github.com/apache/nifi/pull/5362#issuecomment-976439549


   @exceptionfactory should be good to go now.


-- 
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