There is a difference between Eclipse and Maven
- but it depends on how I create the mocks
If I just create a mock for ClassWithStaticInitialiser, without first
attemtpting to create a mock for the static initialiser within this
class, then the test in Eclipse runs and passes
However, the same test in Maven throws a
<error
type="java.lang.NoClassDefFoundError">java.lang.NoClassDefFoundError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at javassist.runtime.Desc.getClassObject(Desc.java:43)
at javassist.runtime.Desc.getClassType(Desc.java:152)
at javassist.runtime.Desc.getType(Desc.java:122)
at javassist.runtime.Desc.getType(Desc.java:78)
at my.pkg.ClassWithStaticInitialiser.<clinit>
(ClassWithStaticInitialiser.java:49)
And line 49, is
private static ClassWithProblemStaticInitialiser aField =
new ClassWithProblemStaticInitialiser();
I don't really care about creating a mock for
ClassWithProblemStaticInitialiser
- as long as I can create a mock for ClassWithStaticInitialiser
But how is Eclipse treating this differently to Maven ?
Any suggestions or insight welcome
GeoffH