[
https://issues.apache.org/jira/browse/NIFI-5289?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16536548#comment-16536548
]
ASF GitHub Bot commented on NIFI-5289:
--------------------------------------
Github user MartinPayne commented on the issue:
https://github.com/apache/nifi/pull/2780
> The global declaration for JUnit is JUnit 4.12. If someone is using v5,
they'll have to work around that.
Yes, we're using a workaround at the moment. We have to declare JUnit 4 as
a dependency with "test" scope, and configure the Maven Dependency Plugin to
force JUnit 4 as used to prevent it from being reported as a declared and
unused dependency. I would prefer to have the fix upstream so that we can
remove the workaround.
> nifi-mock is designed to support JUnit tests and I'm not aware of any
components that use JUnit 5.
I am using JUnit 5, and I imagine over time many other people will be
migrating to it too. Code wise there is nothing in nifi-mock which means it
shouldn't work with JUnit 5, and I would expect it to work with other test
frameworks too.
I've provided a link to a table of Maven dependency scopes to demonstrate
that this won't result in JUnit ending up in non-test code. Are there any
further concerns about this fix?
> NoClassDefFoundError for org.junit.Assert When Using nifi-mock
> --------------------------------------------------------------
>
> Key: NIFI-5289
> URL: https://issues.apache.org/jira/browse/NIFI-5289
> Project: Apache NiFi
> Issue Type: Bug
> Components: Core Framework
> Affects Versions: 1.6.0
> Reporter: Martin Payne
> Priority: Minor
>
> When using the NiFi Mock framework but not using JUnit 4, tests fail with a
> NoClassDefFoundError for org.junit.Assert. This is because nifi-mock sets the
> scope of junit to "provided", which means it's not pulled into consuming
> projects as a transitive dependency. It should be set to "compile" so that
> users don't have to set an explicit JUnit dependency in their projects.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)