[
https://issues.apache.org/jira/browse/NIFI-11528?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17722264#comment-17722264
]
Daniel Stieglitz edited comment on NIFI-11528 at 5/12/23 7:16 PM:
------------------------------------------------------------------
[~exceptionfactory] I was able to refactor most of the
{code:java}
nifi-commons/nifi-utils/src/test/groovy/org/apache/nifi/util/TestFormatUtilsGroovy.groovy
{code}
to a Java equivalent class. There is one particular test which I am having a
problem on its conversion to Java and I would like direction on how to proceed.
Test
{code:java}
testMakeWholeNumberTimeShouldHandleMetricConversions
{code} on lines 292-295 in the original Groovy does not actually run assertions
against all the values held in the variable
{code:java}
results
{code}
rather it only runs against the first entry and then short circuits. I noticed
this when I added
{code:java}
System.out.println("key="+ key + " values" + values)
{code}
as it only printed the first entry.
In the Java equivalent all the scenarios pass except this one
{code:java}
"millisToNanos" : [originalUnits: TimeUnit.MILLISECONDS, expectedUnits:
TimeUnit.NANOSECONDS, originalValue: 0.75, expectedValue: 750_000]
{code}
as the expected unit type is
{code:java}
TimeUnit.MICROSECONDS
{code} and the actual value is 750.
was (Author: JIRAUSER294662):
[~exceptionfactory] I was able to refactor most of the
{code:java}
nifi-commons/nifi-utils/src/test/groovy/org/apache/nifi/util/TestFormatUtilsGroovy.groovy
{code}
to a Java equivalent class. There is one particular test which I am having a
problem on its conversion to Java and I would like direction on how to proceed.
Test
{code:java}
testMakeWholeNumberTimeShouldHandleMetricConversions
{code} on lines 292-295 in the original Groovy does not actually run assertions
against all the values held in the variable
{code:java}
results
{code}
rather it only runs against the first entry and then short circuits. I noticed
this when I added
{code:java}
System.out.println("key="+ key + " values" + values)
{code}
as it only printed the first entry.
In the Java equivalent this test fails on scenario
{code:java}
"millisToNanos" : [originalUnits: TimeUnit.MILLISECONDS, expectedUnits:
TimeUnit.NANOSECONDS, originalValue: 0.75, expectedValue: 750_000]
{code}
as the expected unit type is
{code:java}
TimeUnit.MICROSECONDS
{code} and the actual value is 750.
> Refactor Groovy tests in nifi-commons/nifi-utils to Java (and JUnit 5)
> ----------------------------------------------------------------------
>
> Key: NIFI-11528
> URL: https://issues.apache.org/jira/browse/NIFI-11528
> Project: Apache NiFi
> Issue Type: Sub-task
> Reporter: Daniel Stieglitz
> Assignee: Daniel Stieglitz
> Priority: Minor
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)