[jira] Created: (JMOCK-124) Can't mock classes in Eclipse JUnit Plugin-Tests

View: New views
20 Messages — Rating Filter:   Alert me  
< Prev | 1 - 2 | Next >

[jira] Created: (JMOCK-124) Can't mock classes in Eclipse JUnit Plugin-Tests

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Can't mock classes in Eclipse JUnit Plugin-Tests
------------------------------------------------

                 Key: JMOCK-124
                 URL: http://jira.codehaus.org/browse/JMOCK-124
             Project: jMock
          Issue Type: Bug
    Affects Versions: 2.1.0-RC4
            Reporter: Ulli Hafner


Hi Nat,

when I'm mocking classes with the new 2.1 features, I get an exception for eclipse plugin tests.

On the other hand, when using interfaces in the same unit tests then jmock works well both with Eclipse standard JUnit tests as well as with JUnit Plugin-Tests (the plugin tests start the tests in an eclipse instance with the eclipse class loading mechanisms activated)!

This seems to be a problem of the cglib Library, so I'm not sure whether to file a bug report in this project rather than here (the cglib project seems to be not very active)... I also tried easymock and rmock with cglib: the same behavior, an exception with plugin tests and everything ok with simple JUnit tests.  

net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
        at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:237)
        at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
        at net.sf.cglib.proxy.Enhancer.createClass(Enhancer.java:317)
        at org.jmock.lib.legacy.ClassImposteriser.createProxyClass(ClassImposteriser.java:76)
        at org.jmock.lib.legacy.ClassImposteriser.imposterise(ClassImposteriser.java:54)
        at org.jmock.internal.ReturnDefaultValueAction.invoke(ReturnDefaultValueAction.java:62)
        at org.jmock.Mockery.dispatch(Mockery.java:187)
        at org.jmock.Mockery.access$000(Mockery.java:34)
        at org.jmock.Mockery$MockObject.invoke(Mockery.java:236)
        at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
        at org.jmock.internal.ProxiedObjectIdentity.invoke(ProxiedObjectIdentity.java:36)
        at org.jmock.lib.legacy.ClassImposteriser$3.invoke(ClassImposteriser.java:85)
        at com.avaloq.adt.env.core.model.dbobjects.impl.TaskDBObjectImpl$$EnhancerByCGLIB$$90026834.getChanges(<generated>)
        at com.avaloq.adt.env.internal.ui.properties.audit.model.TaskAuditJobTest$2.<init>(TaskAuditJobTest.java:55)
        at com.avaloq.adt.env.internal.ui.properties.audit.model.TaskAuditJobTest.testMe(TaskAuditJobTest.java:54)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at junit.framework.TestCase.runTest(TestCase.java:154)
        at junit.framework.TestCase.runBare(TestCase.java:127)
        at junit.framework.TestResult$1.protect(TestResult.java:106)
        at junit.framework.TestResult.runProtected(TestResult.java:124)
        at junit.framework.TestResult.run(TestResult.java:109)
        at junit.framework.TestCase.run(TestCase.java:118)
        at junit.framework.TestSuite.runTest(TestSuite.java:208)
        at junit.framework.TestSuite.run(TestSuite.java:203)
        at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
        at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
        at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:58)
        at org.eclipse.pde.internal.junit.runtime.CoreTestApplication.run(CoreTestApplication.java:24)
        at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
        at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
        at org.eclipse.core.launcher.Main.run(Main.java:977)
        at org.eclipse.core.launcher.Main.main(Main.java:952)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:384)
        at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:219)
        ... 46 more
Caused by: java.lang.NullPointerException
        at org.jmock.internal.SearchingClassLoader.findClass(SearchingClassLoader.java:54)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
        ... 52 more



--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

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

    http://xircles.codehaus.org/manage_email


[jira] Updated: (JMOCK-124) Can't mock classes in Eclipse JUnit Plugin-Tests

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


     [ http://jira.codehaus.org/browse/JMOCK-124?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nat Pryce updated JMOCK-124:
----------------------------

         Assignee: Nat Pryce
    Fix Version/s: 2.1.0
      Component/s: Library

> Can't mock classes in Eclipse JUnit Plugin-Tests
> ------------------------------------------------
>
>                 Key: JMOCK-124
>                 URL: http://jira.codehaus.org/browse/JMOCK-124
>             Project: jMock
>          Issue Type: Bug
>          Components: Library
>    Affects Versions: 2.1.0-RC4
>            Reporter: Ulli Hafner
>            Assignee: Nat Pryce
>             Fix For: 2.1.0
>
>
> Hi Nat,
> when I'm mocking classes with the new 2.1 features, I get an exception for eclipse plugin tests.
> On the other hand, when using interfaces in the same unit tests then jmock works well both with Eclipse standard JUnit tests as well as with JUnit Plugin-Tests (the plugin tests start the tests in an eclipse instance with the eclipse class loading mechanisms activated)!
> This seems to be a problem of the cglib Library, so I'm not sure whether to file a bug report in this project rather than here (the cglib project seems to be not very active)... I also tried easymock and rmock with cglib: the same behavior, an exception with plugin tests and everything ok with simple JUnit tests.  
> net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
> at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:237)
> at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
> at net.sf.cglib.proxy.Enhancer.createClass(Enhancer.java:317)
> at org.jmock.lib.legacy.ClassImposteriser.createProxyClass(ClassImposteriser.java:76)
> at org.jmock.lib.legacy.ClassImposteriser.imposterise(ClassImposteriser.java:54)
> at org.jmock.internal.ReturnDefaultValueAction.invoke(ReturnDefaultValueAction.java:62)
> at org.jmock.Mockery.dispatch(Mockery.java:187)
> at org.jmock.Mockery.access$000(Mockery.java:34)
> at org.jmock.Mockery$MockObject.invoke(Mockery.java:236)
> at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
> at org.jmock.internal.ProxiedObjectIdentity.invoke(ProxiedObjectIdentity.java:36)
> at org.jmock.lib.legacy.ClassImposteriser$3.invoke(ClassImposteriser.java:85)
> at com.avaloq.adt.env.core.model.dbobjects.impl.TaskDBObjectImpl$$EnhancerByCGLIB$$90026834.getChanges(<generated>)
> at com.avaloq.adt.env.internal.ui.properties.audit.model.TaskAuditJobTest$2.<init>(TaskAuditJobTest.java:55)
> at com.avaloq.adt.env.internal.ui.properties.audit.model.TaskAuditJobTest.testMe(TaskAuditJobTest.java:54)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at junit.framework.TestCase.runTest(TestCase.java:154)
> at junit.framework.TestCase.runBare(TestCase.java:127)
> at junit.framework.TestResult$1.protect(TestResult.java:106)
> at junit.framework.TestResult.runProtected(TestResult.java:124)
> at junit.framework.TestResult.run(TestResult.java:109)
> at junit.framework.TestCase.run(TestCase.java:118)
> at junit.framework.TestSuite.runTest(TestSuite.java:208)
> at junit.framework.TestSuite.run(TestSuite.java:203)
> at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
> at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:58)
> at org.eclipse.pde.internal.junit.runtime.CoreTestApplication.run(CoreTestApplication.java:24)
> at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
> at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
> at org.eclipse.core.launcher.Main.run(Main.java:977)
> at org.eclipse.core.launcher.Main.main(Main.java:952)
> Caused by: java.lang.reflect.InvocationTargetException
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:384)
> at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:219)
> ... 46 more
> Caused by: java.lang.NullPointerException
> at org.jmock.internal.SearchingClassLoader.findClass(SearchingClassLoader.java:54)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
> ... 52 more

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

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

    http://xircles.codehaus.org/manage_email


[jira] Commented: (JMOCK-124) Can't mock classes in Eclipse JUnit Plugin-Tests

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ http://jira.codehaus.org/browse/JMOCK-124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_96351 ]

Nat Pryce commented on JMOCK-124:
---------------------------------

What is the class-loader structure used to load classes into your plugin tests?  Where is the jMock JAR loaded from in this structure?  Is jMock loaded from a class loader that can see the mocked type?

It might be that you need to write a new Imposteriser that knows how to load classes from the Eclipse workspace.

> Can't mock classes in Eclipse JUnit Plugin-Tests
> ------------------------------------------------
>
>                 Key: JMOCK-124
>                 URL: http://jira.codehaus.org/browse/JMOCK-124
>             Project: jMock
>          Issue Type: Bug
>          Components: Library
>    Affects Versions: 2.1.0-RC4
>            Reporter: Ulli Hafner
>            Assignee: Nat Pryce
>             Fix For: 2.1.0
>
>
> Hi Nat,
> when I'm mocking classes with the new 2.1 features, I get an exception for eclipse plugin tests.
> On the other hand, when using interfaces in the same unit tests then jmock works well both with Eclipse standard JUnit tests as well as with JUnit Plugin-Tests (the plugin tests start the tests in an eclipse instance with the eclipse class loading mechanisms activated)!
> This seems to be a problem of the cglib Library, so I'm not sure whether to file a bug report in this project rather than here (the cglib project seems to be not very active)... I also tried easymock and rmock with cglib: the same behavior, an exception with plugin tests and everything ok with simple JUnit tests.  
> net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
> at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:237)
> at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
> at net.sf.cglib.proxy.Enhancer.createClass(Enhancer.java:317)
> at org.jmock.lib.legacy.ClassImposteriser.createProxyClass(ClassImposteriser.java:76)
> at org.jmock.lib.legacy.ClassImposteriser.imposterise(ClassImposteriser.java:54)
> at org.jmock.internal.ReturnDefaultValueAction.invoke(ReturnDefaultValueAction.java:62)
> at org.jmock.Mockery.dispatch(Mockery.java:187)
> at org.jmock.Mockery.access$000(Mockery.java:34)
> at org.jmock.Mockery$MockObject.invoke(Mockery.java:236)
> at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
> at org.jmock.internal.ProxiedObjectIdentity.invoke(ProxiedObjectIdentity.java:36)
> at org.jmock.lib.legacy.ClassImposteriser$3.invoke(ClassImposteriser.java:85)
> at com.avaloq.adt.env.core.model.dbobjects.impl.TaskDBObjectImpl$$EnhancerByCGLIB$$90026834.getChanges(<generated>)
> at com.avaloq.adt.env.internal.ui.properties.audit.model.TaskAuditJobTest$2.<init>(TaskAuditJobTest.java:55)
> at com.avaloq.adt.env.internal.ui.properties.audit.model.TaskAuditJobTest.testMe(TaskAuditJobTest.java:54)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at junit.framework.TestCase.runTest(TestCase.java:154)
> at junit.framework.TestCase.runBare(TestCase.java:127)
> at junit.framework.TestResult$1.protect(TestResult.java:106)
> at junit.framework.TestResult.runProtected(TestResult.java:124)
> at junit.framework.TestResult.run(TestResult.java:109)
> at junit.framework.TestCase.run(TestCase.java:118)
> at junit.framework.TestSuite.runTest(TestSuite.java:208)
> at junit.framework.TestSuite.run(TestSuite.java:203)
> at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
> at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:58)
> at org.eclipse.pde.internal.junit.runtime.CoreTestApplication.run(CoreTestApplication.java:24)
> at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
> at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
> at org.eclipse.core.launcher.Main.run(Main.java:977)
> at org.eclipse.core.launcher.Main.main(Main.java:952)
> Caused by: java.lang.reflect.InvocationTargetException
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:384)
> at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:219)
> ... 46 more
> Caused by: java.lang.NullPointerException
> at org.jmock.internal.SearchingClassLoader.findClass(SearchingClassLoader.java:54)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
> ... 52 more

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

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

    http://xircles.codehaus.org/manage_email


[jira] Commented: (JMOCK-124) Can't mock classes in Eclipse JUnit Plugin-Tests

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ http://jira.codehaus.org/browse/JMOCK-124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_96353 ]

Nat Pryce commented on JMOCK-124:
---------------------------------

The SearchingClassLoader should not be throwing null-pointer exceptions.  I've checked a fix for that into CVS.



> Can't mock classes in Eclipse JUnit Plugin-Tests
> ------------------------------------------------
>
>                 Key: JMOCK-124
>                 URL: http://jira.codehaus.org/browse/JMOCK-124
>             Project: jMock
>          Issue Type: Bug
>          Components: Library
>    Affects Versions: 2.1.0-RC4
>            Reporter: Ulli Hafner
>            Assignee: Nat Pryce
>             Fix For: 2.1.0
>
>
> Hi Nat,
> when I'm mocking classes with the new 2.1 features, I get an exception for eclipse plugin tests.
> On the other hand, when using interfaces in the same unit tests then jmock works well both with Eclipse standard JUnit tests as well as with JUnit Plugin-Tests (the plugin tests start the tests in an eclipse instance with the eclipse class loading mechanisms activated)!
> This seems to be a problem of the cglib Library, so I'm not sure whether to file a bug report in this project rather than here (the cglib project seems to be not very active)... I also tried easymock and rmock with cglib: the same behavior, an exception with plugin tests and everything ok with simple JUnit tests.  
> net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
> at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:237)
> at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
> at net.sf.cglib.proxy.Enhancer.createClass(Enhancer.java:317)
> at org.jmock.lib.legacy.ClassImposteriser.createProxyClass(ClassImposteriser.java:76)
> at org.jmock.lib.legacy.ClassImposteriser.imposterise(ClassImposteriser.java:54)
> at org.jmock.internal.ReturnDefaultValueAction.invoke(ReturnDefaultValueAction.java:62)
> at org.jmock.Mockery.dispatch(Mockery.java:187)
> at org.jmock.Mockery.access$000(Mockery.java:34)
> at org.jmock.Mockery$MockObject.invoke(Mockery.java:236)
> at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
> at org.jmock.internal.ProxiedObjectIdentity.invoke(ProxiedObjectIdentity.java:36)
> at org.jmock.lib.legacy.ClassImposteriser$3.invoke(ClassImposteriser.java:85)
> at com.avaloq.adt.env.core.model.dbobjects.impl.TaskDBObjectImpl$$EnhancerByCGLIB$$90026834.getChanges(<generated>)
> at com.avaloq.adt.env.internal.ui.properties.audit.model.TaskAuditJobTest$2.<init>(TaskAuditJobTest.java:55)
> at com.avaloq.adt.env.internal.ui.properties.audit.model.TaskAuditJobTest.testMe(TaskAuditJobTest.java:54)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at junit.framework.TestCase.runTest(TestCase.java:154)
> at junit.framework.TestCase.runBare(TestCase.java:127)
> at junit.framework.TestResult$1.protect(TestResult.java:106)
> at junit.framework.TestResult.runProtected(TestResult.java:124)
> at junit.framework.TestResult.run(TestResult.java:109)
> at junit.framework.TestCase.run(TestCase.java:118)
> at junit.framework.TestSuite.runTest(TestSuite.java:208)
> at junit.framework.TestSuite.run(TestSuite.java:203)
> at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
> at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:58)
> at org.eclipse.pde.internal.junit.runtime.CoreTestApplication.run(CoreTestApplication.java:24)
> at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
> at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
> at org.eclipse.core.launcher.Main.run(Main.java:977)
> at org.eclipse.core.launcher.Main.main(Main.java:952)
> Caused by: java.lang.reflect.InvocationTargetException
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:384)
> at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:219)
> ... 46 more
> Caused by: java.lang.NullPointerException
> at org.jmock.internal.SearchingClassLoader.findClass(SearchingClassLoader.java:54)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
> ... 52 more

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

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

    http://xircles.codehaus.org/manage_email


[jira] Commented: (JMOCK-124) Can't mock classes in Eclipse JUnit Plugin-Tests

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ http://jira.codehaus.org/browse/JMOCK-124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_96448 ]

Ulli Hafner commented on JMOCK-124:
-----------------------------------

Hi Nat,

as far as I understand the eclipse class loading strategies, each plugin uses its own class loader, classes from other plugins are not visible here (for details see
http://www.eclipsezone.com/articles/eclipse-vms/).

E.g., when I have the plugin foo with the class Foo and the plugin foo.test with the class FooTest then these classes are loaded by different class loaders. Only the plugin foo.tests has references to the jmock and cglib library.

Maybe its not possible at all to generate classes dynamically in the eclipse runtime with cglib?

Best regards, Ulli

> Can't mock classes in Eclipse JUnit Plugin-Tests
> ------------------------------------------------
>
>                 Key: JMOCK-124
>                 URL: http://jira.codehaus.org/browse/JMOCK-124
>             Project: jMock
>          Issue Type: Bug
>          Components: Library
>    Affects Versions: 2.1.0-RC4
>            Reporter: Ulli Hafner
>            Assignee: Nat Pryce
>             Fix For: 2.1.0
>
>
> Hi Nat,
> when I'm mocking classes with the new 2.1 features, I get an exception for eclipse plugin tests.
> On the other hand, when using interfaces in the same unit tests then jmock works well both with Eclipse standard JUnit tests as well as with JUnit Plugin-Tests (the plugin tests start the tests in an eclipse instance with the eclipse class loading mechanisms activated)!
> This seems to be a problem of the cglib Library, so I'm not sure whether to file a bug report in this project rather than here (the cglib project seems to be not very active)... I also tried easymock and rmock with cglib: the same behavior, an exception with plugin tests and everything ok with simple JUnit tests.  
> net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
> at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:237)
> at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
> at net.sf.cglib.proxy.Enhancer.createClass(Enhancer.java:317)
> at org.jmock.lib.legacy.ClassImposteriser.createProxyClass(ClassImposteriser.java:76)
> at org.jmock.lib.legacy.ClassImposteriser.imposterise(ClassImposteriser.java:54)
> at org.jmock.internal.ReturnDefaultValueAction.invoke(ReturnDefaultValueAction.java:62)
> at org.jmock.Mockery.dispatch(Mockery.java:187)
> at org.jmock.Mockery.access$000(Mockery.java:34)
> at org.jmock.Mockery$MockObject.invoke(Mockery.java:236)
> at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
> at org.jmock.internal.ProxiedObjectIdentity.invoke(ProxiedObjectIdentity.java:36)
> at org.jmock.lib.legacy.ClassImposteriser$3.invoke(ClassImposteriser.java:85)
> at com.avaloq.adt.env.core.model.dbobjects.impl.TaskDBObjectImpl$$EnhancerByCGLIB$$90026834.getChanges(<generated>)
> at com.avaloq.adt.env.internal.ui.properties.audit.model.TaskAuditJobTest$2.<init>(TaskAuditJobTest.java:55)
> at com.avaloq.adt.env.internal.ui.properties.audit.model.TaskAuditJobTest.testMe(TaskAuditJobTest.java:54)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at junit.framework.TestCase.runTest(TestCase.java:154)
> at junit.framework.TestCase.runBare(TestCase.java:127)
> at junit.framework.TestResult$1.protect(TestResult.java:106)
> at junit.framework.TestResult.runProtected(TestResult.java:124)
> at junit.framework.TestResult.run(TestResult.java:109)
> at junit.framework.TestCase.run(TestCase.java:118)
> at junit.framework.TestSuite.runTest(TestSuite.java:208)
> at junit.framework.TestSuite.run(TestSuite.java:203)
> at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
> at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:58)
> at org.eclipse.pde.internal.junit.runtime.CoreTestApplication.run(CoreTestApplication.java:24)
> at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
> at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
> at org.eclipse.core.launcher.Main.run(Main.java:977)
> at org.eclipse.core.launcher.Main.main(Main.java:952)
> Caused by: java.lang.reflect.InvocationTargetException
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:384)
> at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:219)
> ... 46 more
> Caused by: java.lang.NullPointerException
> at org.jmock.internal.SearchingClassLoader.findClass(SearchingClassLoader.java:54)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
> ... 52 more

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

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

    http://xircles.codehaus.org/manage_email


[jira] Commented: (JMOCK-124) Can't mock classes in Eclipse JUnit Plugin-Tests

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ http://jira.codehaus.org/browse/JMOCK-124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_96503 ]

Nat Pryce commented on JMOCK-124:
---------------------------------

Is there anything you can do with "buddy" class loaders?  Is the foo.test bundle a buddy of the foo bundle?  Does that even make a difference?  I'm afraid I don't know anything about writing Eclipse plugins.

If you could make the smallest Eclipse project that demonstrates this problem and send attach it as a tar.gz file I could open it in my IDE and trace through what's going on in the jMock classloader.


> Can't mock classes in Eclipse JUnit Plugin-Tests
> ------------------------------------------------
>
>                 Key: JMOCK-124
>                 URL: http://jira.codehaus.org/browse/JMOCK-124
>             Project: jMock
>          Issue Type: Bug
>          Components: Library
>    Affects Versions: 2.1.0-RC4
>            Reporter: Ulli Hafner
>            Assignee: Nat Pryce
>             Fix For: 2.1.0
>
>
> Hi Nat,
> when I'm mocking classes with the new 2.1 features, I get an exception for eclipse plugin tests.
> On the other hand, when using interfaces in the same unit tests then jmock works well both with Eclipse standard JUnit tests as well as with JUnit Plugin-Tests (the plugin tests start the tests in an eclipse instance with the eclipse class loading mechanisms activated)!
> This seems to be a problem of the cglib Library, so I'm not sure whether to file a bug report in this project rather than here (the cglib project seems to be not very active)... I also tried easymock and rmock with cglib: the same behavior, an exception with plugin tests and everything ok with simple JUnit tests.  
> net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
> at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:237)
> at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
> at net.sf.cglib.proxy.Enhancer.createClass(Enhancer.java:317)
> at org.jmock.lib.legacy.ClassImposteriser.createProxyClass(ClassImposteriser.java:76)
> at org.jmock.lib.legacy.ClassImposteriser.imposterise(ClassImposteriser.java:54)
> at org.jmock.internal.ReturnDefaultValueAction.invoke(ReturnDefaultValueAction.java:62)
> at org.jmock.Mockery.dispatch(Mockery.java:187)
> at org.jmock.Mockery.access$000(Mockery.java:34)
> at org.jmock.Mockery$MockObject.invoke(Mockery.java:236)
> at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
> at org.jmock.internal.ProxiedObjectIdentity.invoke(ProxiedObjectIdentity.java:36)
> at org.jmock.lib.legacy.ClassImposteriser$3.invoke(ClassImposteriser.java:85)
> at com.avaloq.adt.env.core.model.dbobjects.impl.TaskDBObjectImpl$$EnhancerByCGLIB$$90026834.getChanges(<generated>)
> at com.avaloq.adt.env.internal.ui.properties.audit.model.TaskAuditJobTest$2.<init>(TaskAuditJobTest.java:55)
> at com.avaloq.adt.env.internal.ui.properties.audit.model.TaskAuditJobTest.testMe(TaskAuditJobTest.java:54)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at junit.framework.TestCase.runTest(TestCase.java:154)
> at junit.framework.TestCase.runBare(TestCase.java:127)
> at junit.framework.TestResult$1.protect(TestResult.java:106)
> at junit.framework.TestResult.runProtected(TestResult.java:124)
> at junit.framework.TestResult.run(TestResult.java:109)
> at junit.framework.TestCase.run(TestCase.java:118)
> at junit.framework.TestSuite.runTest(TestSuite.java:208)
> at junit.framework.TestSuite.run(TestSuite.java:203)
> at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
> at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:58)
> at org.eclipse.pde.internal.junit.runtime.CoreTestApplication.run(CoreTestApplication.java:24)
> at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
> at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
> at org.eclipse.core.launcher.Main.run(Main.java:977)
> at org.eclipse.core.launcher.Main.main(Main.java:952)
> Caused by: java.lang.reflect.InvocationTargetException
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:384)
> at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:219)
> ... 46 more
> Caused by: java.lang.NullPointerException
> at org.jmock.internal.SearchingClassLoader.findClass(SearchingClassLoader.java:54)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
> ... 52 more

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

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

    http://xircles.codehaus.org/manage_email


[jira] Updated: (JMOCK-124) Can't mock classes in Eclipse JUnit Plugin-Tests

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


     [ http://jira.codehaus.org/browse/JMOCK-124?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ulli Hafner updated JMOCK-124:
------------------------------

    Attachment: jmock-eclipse-plugin.tar.gz

2 Eclipse plugins that expose this behavior. You still need to copy your RC4 jar files to the lib folder of the tests plugin.

The test is quite simple: One class MockMe in the example plugin and a corresponding MockMeTest class in the tests plugin. The first method returns an object of the type MockMe, the second a String. The first test fails , the second works.



> Can't mock classes in Eclipse JUnit Plugin-Tests
> ------------------------------------------------
>
>                 Key: JMOCK-124
>                 URL: http://jira.codehaus.org/browse/JMOCK-124
>             Project: jMock
>          Issue Type: Bug
>          Components: Library
>    Affects Versions: 2.1.0-RC4
>            Reporter: Ulli Hafner
>            Assignee: Nat Pryce
>             Fix For: 2.1.0
>
>         Attachments: jmock-eclipse-plugin.tar.gz
>
>
> Hi Nat,
> when I'm mocking classes with the new 2.1 features, I get an exception for eclipse plugin tests.
> On the other hand, when using interfaces in the same unit tests then jmock works well both with Eclipse standard JUnit tests as well as with JUnit Plugin-Tests (the plugin tests start the tests in an eclipse instance with the eclipse class loading mechanisms activated)!
> This seems to be a problem of the cglib Library, so I'm not sure whether to file a bug report in this project rather than here (the cglib project seems to be not very active)... I also tried easymock and rmock with cglib: the same behavior, an exception with plugin tests and everything ok with simple JUnit tests.  
> net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
> at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:237)
> at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
> at net.sf.cglib.proxy.Enhancer.createClass(Enhancer.java:317)
> at org.jmock.lib.legacy.ClassImposteriser.createProxyClass(ClassImposteriser.java:76)
> at org.jmock.lib.legacy.ClassImposteriser.imposterise(ClassImposteriser.java:54)
> at org.jmock.internal.ReturnDefaultValueAction.invoke(ReturnDefaultValueAction.java:62)
> at org.jmock.Mockery.dispatch(Mockery.java:187)
> at org.jmock.Mockery.access$000(Mockery.java:34)
> at org.jmock.Mockery$MockObject.invoke(Mockery.java:236)
> at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
> at org.jmock.internal.ProxiedObjectIdentity.invoke(ProxiedObjectIdentity.java:36)
> at org.jmock.lib.legacy.ClassImposteriser$3.invoke(ClassImposteriser.java:85)
> at com.avaloq.adt.env.core.model.dbobjects.impl.TaskDBObjectImpl$$EnhancerByCGLIB$$90026834.getChanges(<generated>)
> at com.avaloq.adt.env.internal.ui.properties.audit.model.TaskAuditJobTest$2.<init>(TaskAuditJobTest.java:55)
> at com.avaloq.adt.env.internal.ui.properties.audit.model.TaskAuditJobTest.testMe(TaskAuditJobTest.java:54)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at junit.framework.TestCase.runTest(TestCase.java:154)
> at junit.framework.TestCase.runBare(TestCase.java:127)
> at junit.framework.TestResult$1.protect(TestResult.java:106)
> at junit.framework.TestResult.runProtected(TestResult.java:124)
> at junit.framework.TestResult.run(TestResult.java:109)
> at junit.framework.TestCase.run(TestCase.java:118)
> at junit.framework.TestSuite.runTest(TestSuite.java:208)
> at junit.framework.TestSuite.run(TestSuite.java:203)
> at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
> at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:58)
> at org.eclipse.pde.internal.junit.runtime.CoreTestApplication.run(CoreTestApplication.java:24)
> at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
> at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
> at org.eclipse.core.launcher.Main.run(Main.java:977)
> at org.eclipse.core.launcher.Main.main(Main.java:952)
> Caused by: java.lang.reflect.InvocationTargetException
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:384)
> at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:219)
> ... 46 more
> Caused by: java.lang.NullPointerException
> at org.jmock.internal.SearchingClassLoader.findClass(SearchingClassLoader.java:54)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
> ... 52 more

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

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

    http://xircles.codehaus.org/manage_email


[jira] Commented: (JMOCK-124) Can't mock classes in Eclipse JUnit Plugin-Tests

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ http://jira.codehaus.org/browse/JMOCK-124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_96606 ]

Ulli Hafner commented on JMOCK-124:
-----------------------------------

Hi Nat,

I just tried the Eclipse buddy policy for this example and the test case runs!  

In the example plugin manifest add:
Eclipse-BuddyPolicy: registered

In the tests plugin add:
Eclipse-RegisterBuddy: jmock.example

In my previous attempts I simple interchanged these definitions...

However, my "real" testcase still does not work. This testcase has a lot of dependencies to other plugins. It is hard to find out for which other plugins I need to define this buddy policy (maybe for all my projects?).

It would be nice if you could catch the exception and add additional information, e.g., which class could not be loaded. Then I can add the required buddy policy for the logged classes only.

Thanks, Ulli



> Can't mock classes in Eclipse JUnit Plugin-Tests
> ------------------------------------------------
>
>                 Key: JMOCK-124
>                 URL: http://jira.codehaus.org/browse/JMOCK-124
>             Project: jMock
>          Issue Type: Bug
>          Components: Library
>    Affects Versions: 2.1.0-RC4
>            Reporter: Ulli Hafner
>            Assignee: Nat Pryce
>             Fix For: 2.1.0
>
>         Attachments: jmock-eclipse-plugin.tar.gz
>
>
> Hi Nat,
> when I'm mocking classes with the new 2.1 features, I get an exception for eclipse plugin tests.
> On the other hand, when using interfaces in the same unit tests then jmock works well both with Eclipse standard JUnit tests as well as with JUnit Plugin-Tests (the plugin tests start the tests in an eclipse instance with the eclipse class loading mechanisms activated)!
> This seems to be a problem of the cglib Library, so I'm not sure whether to file a bug report in this project rather than here (the cglib project seems to be not very active)... I also tried easymock and rmock with cglib: the same behavior, an exception with plugin tests and everything ok with simple JUnit tests.  
> net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
> at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:237)
> at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
> at net.sf.cglib.proxy.Enhancer.createClass(Enhancer.java:317)
> at org.jmock.lib.legacy.ClassImposteriser.createProxyClass(ClassImposteriser.java:76)
> at org.jmock.lib.legacy.ClassImposteriser.imposterise(ClassImposteriser.java:54)
> at org.jmock.internal.ReturnDefaultValueAction.invoke(ReturnDefaultValueAction.java:62)
> at org.jmock.Mockery.dispatch(Mockery.java:187)
> at org.jmock.Mockery.access$000(Mockery.java:34)
> at org.jmock.Mockery$MockObject.invoke(Mockery.java:236)
> at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
> at org.jmock.internal.ProxiedObjectIdentity.invoke(ProxiedObjectIdentity.java:36)
> at org.jmock.lib.legacy.ClassImposteriser$3.invoke(ClassImposteriser.java:85)
> at com.avaloq.adt.env.core.model.dbobjects.impl.TaskDBObjectImpl$$EnhancerByCGLIB$$90026834.getChanges(<generated>)
> at com.avaloq.adt.env.internal.ui.properties.audit.model.TaskAuditJobTest$2.<init>(TaskAuditJobTest.java:55)
> at com.avaloq.adt.env.internal.ui.properties.audit.model.TaskAuditJobTest.testMe(TaskAuditJobTest.java:54)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at junit.framework.TestCase.runTest(TestCase.java:154)
> at junit.framework.TestCase.runBare(TestCase.java:127)
> at junit.framework.TestResult$1.protect(TestResult.java:106)
> at junit.framework.TestResult.runProtected(TestResult.java:124)
> at junit.framework.TestResult.run(TestResult.java:109)
> at junit.framework.TestCase.run(TestCase.java:118)
> at junit.framework.TestSuite.runTest(TestSuite.java:208)
> at junit.framework.TestSuite.run(TestSuite.java:203)
> at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
> at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:58)
> at org.eclipse.pde.internal.junit.runtime.CoreTestApplication.run(CoreTestApplication.java:24)
> at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
> at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
> at org.eclipse.core.launcher.Main.run(Main.java:977)
> at org.eclipse.core.launcher.Main.main(Main.java:952)
> Caused by: java.lang.reflect.InvocationTargetException
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:384)
> at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:219)
> ... 46 more
> Caused by: java.lang.NullPointerException
> at org.jmock.internal.SearchingClassLoader.findClass(SearchingClassLoader.java:54)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
> ... 52 more

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

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

    http://xircles.codehaus.org/manage_email


[jira] Closed: (JMOCK-124) Can't mock classes in Eclipse JUnit Plugin-Tests

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


     [ http://jira.codehaus.org/browse/JMOCK-124?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nat Pryce closed JMOCK-124.
---------------------------

    Resolution: Cannot Reproduce

I've raised another issue for better reporting of class-loading problems.

> Can't mock classes in Eclipse JUnit Plugin-Tests
> ------------------------------------------------
>
>                 Key: JMOCK-124
>                 URL: http://jira.codehaus.org/browse/JMOCK-124
>             Project: jMock
>          Issue Type: Bug
>          Components: Library
>    Affects Versions: 2.1.0-RC4
>            Reporter: Ulli Hafner
>            Assignee: Nat Pryce
>             Fix For: 2.1.0
>
>         Attachments: jmock-eclipse-plugin.tar.gz
>
>
> Hi Nat,
> when I'm mocking classes with the new 2.1 features, I get an exception for eclipse plugin tests.
> On the other hand, when using interfaces in the same unit tests then jmock works well both with Eclipse standard JUnit tests as well as with JUnit Plugin-Tests (the plugin tests start the tests in an eclipse instance with the eclipse class loading mechanisms activated)!
> This seems to be a problem of the cglib Library, so I'm not sure whether to file a bug report in this project rather than here (the cglib project seems to be not very active)... I also tried easymock and rmock with cglib: the same behavior, an exception with plugin tests and everything ok with simple JUnit tests.  
> net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
> at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:237)
> at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
> at net.sf.cglib.proxy.Enhancer.createClass(Enhancer.java:317)
> at org.jmock.lib.legacy.ClassImposteriser.createProxyClass(ClassImposteriser.java:76)
> at org.jmock.lib.legacy.ClassImposteriser.imposterise(ClassImposteriser.java:54)
> at org.jmock.internal.ReturnDefaultValueAction.invoke(ReturnDefaultValueAction.java:62)
> at org.jmock.Mockery.dispatch(Mockery.java:187)
> at org.jmock.Mockery.access$000(Mockery.java:34)
> at org.jmock.Mockery$MockObject.invoke(Mockery.java:236)
> at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
> at org.jmock.internal.ProxiedObjectIdentity.invoke(ProxiedObjectIdentity.java:36)
> at org.jmock.lib.legacy.ClassImposteriser$3.invoke(ClassImposteriser.java:85)
> at com.avaloq.adt.env.core.model.dbobjects.impl.TaskDBObjectImpl$$EnhancerByCGLIB$$90026834.getChanges(<generated>)
> at com.avaloq.adt.env.internal.ui.properties.audit.model.TaskAuditJobTest$2.<init>(TaskAuditJobTest.java:55)
> at com.avaloq.adt.env.internal.ui.properties.audit.model.TaskAuditJobTest.testMe(TaskAuditJobTest.java:54)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at junit.framework.TestCase.runTest(TestCase.java:154)
> at junit.framework.TestCase.runBare(TestCase.java:127)
> at junit.framework.TestResult$1.protect(TestResult.java:106)
> at junit.framework.TestResult.runProtected(TestResult.java:124)
> at junit.framework.TestResult.run(TestResult.java:109)
> at junit.framework.TestCase.run(TestCase.java:118)
> at junit.framework.TestSuite.runTest(TestSuite.java:208)
> at junit.framework.TestSuite.run(TestSuite.java:203)
> at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
> at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:58)
> at org.eclipse.pde.internal.junit.runtime.CoreTestApplication.run(CoreTestApplication.java:24)
> at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java