After reading the page at https://developer.atlassian.com/display/JIRADEV/Renamable+Users+in+JIRA+6.0, I wanted to write some new unit tests for my refactored plugins.
I started simple:
@RunWith(MockitoJUnitRunner.class) public class SneiUserIsApproverForReleaseConditionTest { @Before public void setUp() { new MockComponentWorker().init(); } @Test public void dummyTest() { assertTrue(true); } }
But that failed with this stack trace:
java.lang.NoClassDefFoundError: com/atlassian/jira/user/util/UserKeyStore at ut.some.plugin.package.SomeTestClass.setUp(SomeTestClass.java:21) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) at org.junit.runners.ParentRunner.run(ParentRunner.java:300) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) Caused by: java.lang.ClassNotFoundException: com.atlassian.jira.user.util.UserKeyStore at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) ... 24 more
What have I missed? And no, it's not as simple as importing com.atlassian.jira.user.util.UserKeyStore. :) I wish it was!
Community moderators have prevented the ability to post new answers.
I ran into this problem too. The decleration of com/atlassian/jira/user/util/UserKeyStore is in jira-core so I added that as a dependency in pom.xml and it solved the problem for me:
<dependency> <groupId>com.atlassian.jira</groupId> <artifactId>jira-core</artifactId> <version>6.0.1</version> <scope>provided</scope> </dependency>
Thanks Ben! That did it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Even when creating a new project from scratch with atlas-create-jira-plugin and adding the single setUp() method...same. Is something missing from my pom?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I should mention that I have the jira-tests artifact specified in the project's pom, and the jar is on the build path.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.