[ https://issues.apache.org/jira/browse/BEAM-298?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15862327#comment-15862327 ]
Stas Levin edited comment on BEAM-298 at 2/11/17 11:39 AM: ----------------------------------------------------------- After taking a deeper look, {{beam-sdks-java-core}} declares {{junit}} as a {{provided}} dependency, which makes it availiable in compile and test scopes ^1^ (since it has both compile and test scope needs for {{junit}}). Modules that depend on {{beam-sdks-java-core}} in {{compile}} scope do not get {{junit}} due to maven's transitive dependency rules ^1^, so they need to explicitly declare their dependency on {{junit}} in either the {{provided}} or {{test}} scope, according to their needs. If you do not have a compile time dependency on {{junit}} (which I assume is the case since your code probably compiles and the error you describe is a runtime one), I would expect the addition of a {{test}} scope dependency to fix the problem. Since it doesn't, I'm tempted to believe you're using the {{TestPipeline}} in a non {{test}} scope, where {{junit}} can indeed be missing from the classpath ^2^. Could you please provide some more info regarding your scenario? Are you running {{TestPipeline}} as part of a unit test or production code on your end? 1. https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope 2. Or I could be completely wrong and the problem lies elsewhere. was (Author: staslev): After taking a deeper look, {{beam-sdks-java-core}} declares {{junit}} as a {{provided}} dependency, which makes it availiable in compile and test scopes ^1^ (since it has both compile and test scope needs for {{junit}}). Modules that depend on {{beam-sdks-java-core}} in {{compile}} scope do not get {{junit}} due to maven's transitive dependency rules ^1^, so they need to explicitly declare their dependency on {{junit}} in either the {{provided}} or {{test}} scope, according to their needs. If you do not have a compile time dependency on {{junit}} (which I assume is the case since your code probably compiles and the error you describe is a runtime one), I would expect adding a {{test}} scope dependency to fix the problem. Since it doesn't, I'm tempted to believe you're using the {{TestPipeline}} in a non {{test}} scope, where {{junit}} can indeed be missing from the classpath ^2^. Could you please provide some more info regarding your scenario? Are you running {{TestPipeline}} as part of a unit test or production code on your end? 1. https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope 2. Or I could be completely wrong and the problem lies elsewhere. > Make TestPipeline implement the TestRule interface > -------------------------------------------------- > > Key: BEAM-298 > URL: https://issues.apache.org/jira/browse/BEAM-298 > Project: Beam > Issue Type: Improvement > Components: sdk-java-core > Reporter: Thomas Groh > Assignee: Stas Levin > Priority: Minor > Fix For: 0.5.0 > > > https://github.com/junit-team/junit4/wiki/Rules > A JUnit Rule allows a test to use a field annotated with @Rule to wrap > executing tests. Doing so allows the TestPipeline to, at the time the test > completes, assert that all applied transforms have been executed. This > ensures that all unit tests that utilize a TestPipeline rule either are > declared to explicitly not expect to execute or have executed the pipeline. -- This message was sent by Atlassian JIRA (v6.3.15#6346)