[ 
https://issues.apache.org/jira/browse/NIFI-14312?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Daniel Stieglitz updated NIFI-14312:
------------------------------------
    Description: 
There are a few areas of duplicate code which can be cleaned up, there is 
ability to make paramaterized tests and various Intellij suggestions to address 
as well.

The duplicate code issues which can be cleaned up is
 # The declaration of TestRunners.newTestRunner(new IdentifyMimeType()); in 
each of the tests. A private variable can be made and instantiated in a method 
annotated with Junit 5 BeforeEach annotation.
 # Retrieval of the test files is duplicated five times. In addition, the logic 
to filter out directories can be included in the filter used in listFiles.

Any of the tests which test against all the test files namely testFiles, 
testReplaceWithConfigBody, testReplaceWithConfigFile, testMergeWithConfigBody 
and testMergeWithConfigFile can be converted to paramaterized tests.

The Intellij suggestions are
 # Class variable CONFIG_BODY value which is concatenated, can be replaced with 
text block line 40
 # get(0) call on java.util.List cab be replaced with getFirst line 124
 # Lambda can be replaced with method reference lines 409 and 421

  was:
There are a few areas of duplicate code which can be cleaned up, there is 
ability to make paramaterized tests and various Intellij suggestions to address 
as well.

The duplicate code issues which can be cleaned up is
 # The declaration of TestRunners.newTestRunner(new IdentifyMimeType()); in 
each of the tests. A private variable can be made and instantiated in a method 
annotated with Junit 5 BeforeEach annotation.
 # Retrieval of the test files is duplicated five times. In addition the logic 
to filter out directories can be included in the filter used in listFiles.

Any of the tests which test against all the test files namely testFiles, 
testReplaceWithConfigBody, testReplaceWithConfigFile, testMergeWithConfigBody 
and testMergeWithConfigFile can be converted to paramaterized tests.

The Intellij suggestions are
 # Class variable CONFIG_BODY value which is concatenated, can be replaced with 
text block line 40
 # get(0) call on java.util.List cab be replaced with getFirst line 124
 # Lambda can be replaced with method reference lines 409 and 421


> Improvements to TestIdentifyMimeType
> ------------------------------------
>
>                 Key: NIFI-14312
>                 URL: https://issues.apache.org/jira/browse/NIFI-14312
>             Project: Apache NiFi
>          Issue Type: Improvement
>            Reporter: Daniel Stieglitz
>            Assignee: Daniel Stieglitz
>            Priority: Minor
>
> There are a few areas of duplicate code which can be cleaned up, there is 
> ability to make paramaterized tests and various Intellij suggestions to 
> address as well.
> The duplicate code issues which can be cleaned up is
>  # The declaration of TestRunners.newTestRunner(new IdentifyMimeType()); in 
> each of the tests. A private variable can be made and instantiated in a 
> method annotated with Junit 5 BeforeEach annotation.
>  # Retrieval of the test files is duplicated five times. In addition, the 
> logic to filter out directories can be included in the filter used in 
> listFiles.
> Any of the tests which test against all the test files namely testFiles, 
> testReplaceWithConfigBody, testReplaceWithConfigFile, testMergeWithConfigBody 
> and testMergeWithConfigFile can be converted to paramaterized tests.
> The Intellij suggestions are
>  # Class variable CONFIG_BODY value which is concatenated, can be replaced 
> with text block line 40
>  # get(0) call on java.util.List cab be replaced with getFirst line 124
>  # Lambda can be replaced with method reference lines 409 and 421



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to