Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6636847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:14:15+00:00 2026-05-25T23:14:15+00:00

i am writing the junit using easy mock for my program. Below is the

  • 0

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)

Any Pointers?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T23:14:16+00:00Added an answer on May 25, 2026 at 11:14 pm

    You have the wrong version of the dependencies for Easymock. Looking at the maven pom for EasyMock 3.0, the dependencies are:

      <dependency>
        <groupId>cglib</groupId>
        <artifactId>cglib-nodep</artifactId>
        <version>2.2</version>
      </dependency>
      <dependency>
        <groupId>org.objenesis</groupId>
        <artifactId>objenesis</artifactId>
        <version>1.2</version>
      </dependency>
    

    or the EasyMock documentation:

    Requirements

    • EasyMock only works with Java 1.5.0 and above.
    • cglib (2.2) and Objenesis (1.2) must be in the classpath to perform
      class mocking

    So you’re using version 2.2.2 rather than 2.2. java.lang.VerifyError generally happens when you’ve compiled against one library but then are executing against another version of the library.

    See the answers to Reasons of getting a java.lang.VerifyError and the javadoc for java.lang.VerifyError

    Note: to find the above dependency details, you simply need to search on Maven Search.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a JUnit test using JUnitPerf. Here, I want to generate some entries
I'm writing a JUnit test and also using Mockito, and I want to call
I am writing my unit test cases for a Java project using Scala (JUnit
I'm using Spring 3.1.0.M2. I'm writing some JUnit 4 tests to test some database
I'm writing a JUnit test for some code that produces an Excel file (which
I'm writing a jUnit test for a constructor that parses a String and then
I am writing a junit test in order to (surprisingly) test a part of
Possible Duplicate: Choose order to execute JUnit tests I am writing a JUnit test.
Hello I'm writting junit test how can I test this method .. this is
Writing something like this using the loki library , typedef Functor<void> BitButtonPushHandler; throws a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.