You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I came across the testing/mocking framework that you provided in the hazelcast library. So I just started to use new TestHazelcastInstanceFactory(1).newHazelcastInstance(config) in my tests rather than spinning up a real instance. One improvement is that running the corresponding tests is now 4 times as fast!
However, as I use Scala with ScalaTest as my testing framework, I found I also have to import the JUnit library. The reason for this is because com.hazelcast.test.mocknetwork.MockJoiner has a dependency on org.junit.Assert. When the JUnit dependency is not included by hand (e.g. in my own pom.xml), I get a java.lang.NoClassDefFoundError: org/junit/Assert while the test instance is spinning up:
Sep 12, 2016 9:13:28 AM com.hazelcast.system
INFO: [127.0.0.1]:5001 [dev] [3.6.4] Hazelcast 3.6.4 (20160701 - 5b94d9f) starting at Address[127.0.0.1]:5001
Sep 12, 2016 9:13:28 AM com.hazelcast.system
INFO: [127.0.0.1]:5001 [dev] [3.6.4] Copyright (c) 2008-2016, Hazelcast, Inc. All Rights Reserved.
Sep 12, 2016 9:13:28 AM com.hazelcast.system
INFO: [127.0.0.1]:5001 [dev] [3.6.4] Configured Hazelcast Serialization version : 1
Sep 12, 2016 9:13:28 AM com.hazelcast.spi.OperationService
INFO: [127.0.0.1]:5001 [dev] [3.6.4] Backpressure is disabled
Sep 12, 2016 9:13:28 AM com.hazelcast.spi.impl.operationexecutor.classic.ClassicOperationExecutor
INFO: [127.0.0.1]:5001 [dev] [3.6.4] Starting with 4 generic operation threads and 8 partition operation threads.
Sep 12, 2016 9:13:28 AM com.hazelcast.core.LifecycleService
INFO: [127.0.0.1]:5001 [dev] [3.6.4] Address[127.0.0.1]:5001 is STARTING
Sep 12, 2016 9:13:28 AM com.hazelcast.instance.Node
SEVERE: [127.0.0.1]:5001 [dev] [3.6.4] Error while joining the cluster!
java.lang.NoClassDefFoundError: org/junit/Assert
at com.hazelcast.test.mocknetwork.MockJoiner.doJoin(MockJoiner.java:55)
at com.hazelcast.cluster.impl.AbstractJoiner.join(AbstractJoiner.java:103)
at com.hazelcast.instance.Node.join(Node.java:581)
at com.hazelcast.instance.Node.start(Node.java:339)
at com.hazelcast.instance.HazelcastInstanceImpl.<init>(HazelcastInstanceImpl.java:131)
at com.hazelcast.instance.HazelcastInstanceFactory.constructHazelcastInstance(HazelcastInstanceFactory.java:160)
at com.hazelcast.instance.HazelcastInstanceFactory.newHazelcastInstance(HazelcastInstanceFactory.java:143)
at com.hazelcast.test.TestHazelcastInstanceFactory.newHazelcastInstance(TestHazelcastInstanceFactory.java:112)
<more stack trace stuff>
Caused by: java.lang.ClassNotFoundException: org.junit.Assert
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 75 more
Below are listed the hazelcast dependencies in my pom.xml:
Do you have any suggestions how to fix this? I would prefer not to have the JUnit dependency in my project as I'm using another testing framework. Would it be possible to make MockJoiner (and maybe other classes that have the same dependency) agnostic to testing frameworks (e.g. not depend on JUnit)?
The text was updated successfully, but these errors were encountered:
Unlike regular Hazelcast API there is no compatibility guarantee on test-support classes.
There are some other parts of the test-support with hard dependencies on JUnit - see HazelcastTestSupport. So removing this dependency in total is probably not feasible.
However it should not be that hard to do so in the MockJoiner. Do you have any idea what to use instead? Would you like to a send a PR?
I guess an alternative to consider is using the assert keyword from Java itself instead. If I'm not mistaken this keyword is mainly used for testing invariants. Sure I can do a PR for that and remove some of the JUnit dependencies in classes like MockJoiner. As I do not have much time, this may take a couple of days though. Let's keep in touch on this issue!
Btw. if you got a better idea than the assert keyword, let me know!
I came across the testing/mocking framework that you provided in the hazelcast library. So I just started to use
new TestHazelcastInstanceFactory(1).newHazelcastInstance(config)
in my tests rather than spinning up a real instance. One improvement is that running the corresponding tests is now 4 times as fast!However, as I use Scala with ScalaTest as my testing framework, I found I also have to import the JUnit library. The reason for this is because
com.hazelcast.test.mocknetwork.MockJoiner
has a dependency onorg.junit.Assert
. When the JUnit dependency is not included by hand (e.g. in my ownpom.xml
), I get ajava.lang.NoClassDefFoundError: org/junit/Assert
while the test instance is spinning up:Below are listed the hazelcast dependencies in my
pom.xml
:Do you have any suggestions how to fix this? I would prefer not to have the JUnit dependency in my project as I'm using another testing framework. Would it be possible to make
MockJoiner
(and maybe other classes that have the same dependency) agnostic to testing frameworks (e.g. not depend on JUnit)?The text was updated successfully, but these errors were encountered: