Java Mailing List Archive

http://www.gg3721.com/

Home » user.jmock »

[jmock-user] Re: Error attempting to mock concrete class

Sam

2009-10-12

Replies: Find Java Web Hosting

Author LoginPost Reply
Ignat Zapolsky <izapolsky@(protected):

>
> Could you please include full text of test fixture ?
>

Hi Ignat,

Thanks for your reply. A class as simple as the following generates the error.

Regards,
Sam


package biz.pgood.air;

import org.jmock.integration.junit3.MockObjectTestCase;
import org.jmock.lib.legacy.ClassImposteriser;

import java.util.logging.Logger;

import j2ee.ClientServices;
import biz.domain.fn.Money;

/**
*/
public class AirCommissionCalculatorTest extends MockObjectTestCase {
  {
    setImposteriser(ClassImposteriser.INSTANCE);  
  }



  public void testSomething() {
    Logger log = mock(Logger.class);
   
    AirComissionAndCM_Calculator.doSomething(log);
  }
}



> Sam wrote:
> > Sam<mail@(protected):
> >
> >
> >  
> >> I'm receiving the error below while attempting to mock java.util.Logger :
> >>    
> >
> >  
> >> java.lang.NullPointerException
> >> at net.sf.cglib.proxy.EnhancerEmitter$4.getMethods
> >> (EnhancerEmitter.java:407)
> >> at net.sf.cglib.proxy.NoOpGenerator.generate
> >> (NoOpGenerator.java:69)
> >> at net.sf.cglib.proxy.EnhancerEmitter.emitMethods
> >>    
> >
> >
> > Error received while attempting to mock concrete classes.
> >
> > Specifically, adding the following lines to my test class generates the error
> > detailed in my previous post:
> >
> > {
> >   setImposteriser(ClassImposteriser.INSTANCE);
> > }
> >
> > Surely I can't be the only person to have run into this issue?
> >
> > Any input (I mean it, any!) would be appreciated.
> > -Sam
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe from this list, please visit:
> >
> >    http://xircles.codehaus.org/manage_email
> >
> >
> >  
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>   http://xircles.codehaus.org/manage_email
>
>





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

  http://xircles.codehaus.org/manage_email


©2008 gg3721.com - Jax Systems, LLC, U.S.A.