1 Reply Latest reply: Oct 2, 2011 2:19 PM by 891945 RSS

    Writing Junit with EasyMock?

    866541
      i am writing the junit using easy mock for my program. Below is the test method
      public static void doBeforeEachTestCase() {
      
           private static FibanocciProg mock;
              
                mock = EasyMock.createMock(FibanocciProg.class);
                
                FibanocciProg testObject= new FibanocciProg();
              
              EasyMock.expect(mock.recursionFib1(6)).andReturn(50);
              EasyMock.replay(mock);
              int actual = testObject.recursionFib1(6);
              
           }
      I am getting below error in eclipse while EasyMock.createMock. The libs i have downloaded for easy mock are:- easymock-3.0,cglib-2.2.2,asm-4.0_RC2



      Exception in thread "main" java.lang.VerifyError: class net.sf.cglib.core.DebuggingClassWriter overrides final method visit.(IILjava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)V
           at java.lang.ClassLoader.defineClass1(Native Method)
           at java.lang.ClassLoader.defineClassCond(Unknown Source)
           at java.lang.ClassLoader.defineClass(Unknown Source)
           at java.security.SecureClassLoader.defineClass(Unknown Source)
           at java.net.URLClassLoader.defineClass(Unknown Source)
           at java.net.URLClassLoader.access$000(Unknown Source)
           at java.net.URLClassLoader$1.run(Unknown Source)
           at java.security.AccessController.doPrivileged(Native Method)
           at java.net.URLClassLoader.findClass(Unknown Source)
           at java.lang.ClassLoader.loadClass(Unknown Source)
           at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
           at java.lang.ClassLoader.loadClass(Unknown Source)
           at net.sf.cglib.core.AbstractClassGenerator.<init>(AbstractClassGenerator.java:38)
           at net.sf.cglib.core.KeyFactory$Generator.<init>(KeyFactory.java:127)
           at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:112)
           at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:108)
           at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:104)
           at net.sf.cglib.proxy.Enhancer.<clinit>(Enhancer.java:69)
           at org.easymock.internal.ClassProxyFactory.createEnhancer(ClassProxyFactory.java:259)
           at org.easymock.internal.ClassProxyFactory.createProxy(ClassProxyFactory.java:174)
           at org.easymock.internal.MocksControl.createMock(MocksControl.java:60)
           at org.easymock.EasyMock.createMock(EasyMock.java:104)
           at TestMock.doBeforeEachTestCase(TestMock.java:19)
           at TestMock.main(TestMock.java:13)