Re: EasyMock for GWT + MVP ?
Cool - glad to hear you're up and running. On Oct 27, 1:32 am, fker...@gmail.com fker...@gmail.com wrote: On Oct 25, 5:26 pm, lowecg2004 chris.lowe...@gmail.com wrote: As Arthur said, calling GWTMockUtilities.disarm() will prevent that error (that was in part 2 of my article :) As for needing asm-attrs.jar, I guess try it - any NoClassDefFoundError that looks asm related then that will answer your question... Hi! Thanks for the help -- and as of now, everything is running fine without asm-attrs.jar, though I'll keep it in mind just in case.. ;-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en -~--~~~~--~~--~--~---
Re: EasyMock for GWT + MVP ?
On Oct 25, 5:26 pm, lowecg2004 chris.lowe...@gmail.com wrote: As Arthur said, calling GWTMockUtilities.disarm() will prevent that error (that was in part 2 of my article :) As for needing asm-attrs.jar, I guess try it - any NoClassDefFoundError that looks asm related then that will answer your question... Hi! Thanks for the help -- and as of now, everything is running fine without asm-attrs.jar, though I'll keep it in mind just in case.. ;-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en -~--~~~~--~~--~--~---
Re: EasyMock for GWT + MVP ?
Your error looks like you're using the EasyMock class extensions and are missing cglib jars from your build path. As it happens, I recently produced a getting started with MVP and unit testing with EasyMock article which might be of use: http://blog.hivedevelopment.co.uk/2009/10/introduction-to-mvp-unit-testing-part.html Cheers, Chris. On Oct 25, 4:58 am, fker...@gmail.com fker...@gmail.com wrote: I remember EasyMock didn't work for GWT, because it needed reflection, which wasn't available for client side programming. However, I'm doing MVP tests, so the code need not run in hosted mode, so EasyMode should run... right? However, I'm getting the following error -- can somebody point me in the right direction? java.lang.NoClassDefFoundError: net/sf/cglib/proxy/Enhancer at org.easymock.classextension.internal.MocksClassControl.createProxyFactory (MocksClassControl.java:78) at org.easymock.internal.MocksControl.createMock(MocksControl.java: 50) at org.easymock.classextension.EasyMock.createMock(EasyMock.java:46) at com.fkereki.mvptest.client.LoginPresenterTest.setUp (LoginPresenterTest.java:18) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall (FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run (ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively (FrameworkMethod.java:41) at org.junit.internal.runners.statements.RunBefores.evaluate (RunBefores.java:27) at org.junit.internal.runners.statements.RunAfters.evaluate (RunAfters.java:31) at org.junit.runners.BlockJUnit4ClassRunner.runChild (BlockJUnit4ClassRunner.java:73) at org.junit.runners.BlockJUnit4ClassRunner.runChild (BlockJUnit4ClassRunner.java:46) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41) at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173) at org.junit.internal.runners.statements.RunBefores.evaluate (RunBefores.java:28) at org.junit.internal.runners.statements.RunAfters.evaluate (RunAfters.java:31) at org.junit.runners.ParentRunner.run(ParentRunner.java:220) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run (JUnit4TestReference.java:46) at org.eclipse.jdt.internal.junit.runner.TestExecution.run (TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run (RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main (RemoteTestRunner.java:197) Caused by: java.lang.ClassNotFoundException: net.sf.cglib.proxy.Enhancer at java.net.URLClassLoader$1.run(URLClassLoader.java:217) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:323) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:268) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:336) ... 27 more --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en -~--~~~~--~~--~--~---
Re: EasyMock for GWT + MVP ?
On Oct 25, 9:11 am, lowecg2004 chris.lowe...@gmail.com wrote: Your error looks like you're using the EasyMock class extensions and are missing cglib jars from your build path. As it happens, I recently produced a getting started with MVP and unit testing with EasyMock article which might be of use: http://blog.hivedevelopment.co.uk/2009/10/introduction-to-mvp-unit-te... Hi! Thanks for the heads up -- however, I find a couple of details: * I added asm-3.1.jar and cglib-2.2.jar, which were in the GWT 2.0 tools/lib directory, but there was no asm-attrs.jar; do you still need it? * When running an empty JUnit (*not* GWTTestCase) test, which just does loginViewMock=createMock(LoginView.class) I get another exception... The GWT.create( ) problem -- how did you handle it? Or did I miss a step in your article? Thanks!! java.lang.ExceptionInInitializerError at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at net.sf.cglib.proxy.Enhancer.setCallbacksHelper(Enhancer.java:619) at net.sf.cglib.proxy.Enhancer.setThreadCallbacks(Enhancer.java:612) at net.sf.cglib.proxy.Enhancer.registerCallbacks(Enhancer.java:581) at org.easymock.classextension.internal.ClassProxyFactory.createProxy (ClassProxyFactory.java:108) at org.easymock.internal.MocksControl.createMock(MocksControl.java: 51) at org.easymock.classextension.EasyMock.createMock(EasyMock.java:46) at com.fkereki.mvptest.client.LoginPresenterTest.testLoginPresenter1 (LoginPresenterTest.java:26) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall (FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run (ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively (FrameworkMethod.java:41) at org.junit.internal.runners.statements.InvokeMethod.evaluate (InvokeMethod.java:20) at org.junit.internal.runners.statements.RunBefores.evaluate (RunBefores.java:28) at org.junit.internal.runners.statements.RunAfters.evaluate (RunAfters.java:31) at org.junit.runners.BlockJUnit4ClassRunner.runChild (BlockJUnit4ClassRunner.java:73) at org.junit.runners.BlockJUnit4ClassRunner.runChild (BlockJUnit4ClassRunner.java:46) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41) at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173) at org.junit.internal.runners.statements.RunBefores.evaluate (RunBefores.java:28) at org.junit.internal.runners.statements.RunAfters.evaluate (RunAfters.java:31) at org.junit.runners.ParentRunner.run(ParentRunner.java:220) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run (JUnit4TestReference.java:46) at org.eclipse.jdt.internal.junit.runner.TestExecution.run (TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run (RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main (RemoteTestRunner.java:197) Caused by: java.lang.UnsupportedOperationException: ERROR: GWT.create () is only usable in client code! It cannot be called, for example, from server code. If you are running a unit test, check that your test case extends GWTTestCase and that GWT.create() is not called from within an initializer or constructor. at com.google.gwt.core.client.GWT.create(GWT.java:92) at com.google.gwt.user.client.ui.UIObject.clinit(UIObject.java:140) ... 35 more --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en -~--~~~~--~~--~--~---
Re: EasyMock for GWT + MVP ?
It's possible to use EasyMock to mock out GWT widgets in a standard JUnit or TestNG test, but you need to use GWTMockUtilities to disarm GWT. -- Arthur Kalmenson On Sun, Oct 25, 2009 at 12:58 AM, fker...@gmail.com fker...@gmail.com wrote: I remember EasyMock didn't work for GWT, because it needed reflection, which wasn't available for client side programming. However, I'm doing MVP tests, so the code need not run in hosted mode, so EasyMode should run... right? However, I'm getting the following error -- can somebody point me in the right direction? java.lang.NoClassDefFoundError: net/sf/cglib/proxy/Enhancer at org.easymock.classextension.internal.MocksClassControl.createProxyFactory (MocksClassControl.java:78) at org.easymock.internal.MocksControl.createMock(MocksControl.java: 50) at org.easymock.classextension.EasyMock.createMock(EasyMock.java:46) at com.fkereki.mvptest.client.LoginPresenterTest.setUp (LoginPresenterTest.java:18) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall (FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run (ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively (FrameworkMethod.java:41) at org.junit.internal.runners.statements.RunBefores.evaluate (RunBefores.java:27) at org.junit.internal.runners.statements.RunAfters.evaluate (RunAfters.java:31) at org.junit.runners.BlockJUnit4ClassRunner.runChild (BlockJUnit4ClassRunner.java:73) at org.junit.runners.BlockJUnit4ClassRunner.runChild (BlockJUnit4ClassRunner.java:46) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41) at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173) at org.junit.internal.runners.statements.RunBefores.evaluate (RunBefores.java:28) at org.junit.internal.runners.statements.RunAfters.evaluate (RunAfters.java:31) at org.junit.runners.ParentRunner.run(ParentRunner.java:220) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run (JUnit4TestReference.java:46) at org.eclipse.jdt.internal.junit.runner.TestExecution.run (TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run (RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main (RemoteTestRunner.java:197) Caused by: java.lang.ClassNotFoundException: net.sf.cglib.proxy.Enhancer at java.net.URLClassLoader$1.run(URLClassLoader.java:217) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:323) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:268) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:336) ... 27 more --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en -~--~~~~--~~--~--~---
Re: EasyMock for GWT + MVP ?
As Arthur said, calling GWTMockUtilities.disarm() will prevent that error (that was in part 2 of my article :) As for needing asm-attrs.jar, I guess try it - any NoClassDefFoundError that looks asm related then that will answer your question... Cheers, Chris. On Oct 25, 5:44 pm, Arthur Kalmenson arthur.k...@gmail.com wrote: It's possible to use EasyMock to mock out GWT widgets in a standard JUnit or TestNG test, but you need to use GWTMockUtilities to disarm GWT. -- Arthur Kalmenson On Sun, Oct 25, 2009 at 12:58 AM, fker...@gmail.com fker...@gmail.com wrote: I remember EasyMock didn't work for GWT, because it needed reflection, which wasn't available for client side programming. However, I'm doing MVP tests, so the code need not run in hosted mode, so EasyMode should run... right? However, I'm getting the following error -- can somebody point me in the right direction? java.lang.NoClassDefFoundError: net/sf/cglib/proxy/Enhancer at org.easymock.classextension.internal.MocksClassControl.createProxyFactory (MocksClassControl.java:78) at org.easymock.internal.MocksControl.createMock(MocksControl.java: 50) at org.easymock.classextension.EasyMock.createMock(EasyMock.java:46) at com.fkereki.mvptest.client.LoginPresenterTest.setUp (LoginPresenterTest.java:18) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall (FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run (ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively (FrameworkMethod.java:41) at org.junit.internal.runners.statements.RunBefores.evaluate (RunBefores.java:27) at org.junit.internal.runners.statements.RunAfters.evaluate (RunAfters.java:31) at org.junit.runners.BlockJUnit4ClassRunner.runChild (BlockJUnit4ClassRunner.java:73) at org.junit.runners.BlockJUnit4ClassRunner.runChild (BlockJUnit4ClassRunner.java:46) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41) at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173) at org.junit.internal.runners.statements.RunBefores.evaluate (RunBefores.java:28) at org.junit.internal.runners.statements.RunAfters.evaluate (RunAfters.java:31) at org.junit.runners.ParentRunner.run(ParentRunner.java:220) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run (JUnit4TestReference.java:46) at org.eclipse.jdt.internal.junit.runner.TestExecution.run (TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run (RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main (RemoteTestRunner.java:197) Caused by: java.lang.ClassNotFoundException: net.sf.cglib.proxy.Enhancer at java.net.URLClassLoader$1.run(URLClassLoader.java:217) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:323) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:268) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:336) ... 27 more --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en -~--~~~~--~~--~--~---
Re: EasyMock for GWT + MVP ?
On 25 oct, 14:32, fker...@gmail.com fker...@gmail.com wrote: On Oct 25, 9:11 am, lowecg2004 chris.lowe...@gmail.com wrote: Your error looks like you're using the EasyMock class extensions and are missing cglib jars from your build path. As it happens, I recently produced a getting started with MVP and unit testing with EasyMock article which might be of use: http://blog.hivedevelopment.co.uk/2009/10/introduction-to-mvp-unit-te... Hi! Thanks for the heads up -- however, I find a couple of details: * I added asm-3.1.jar and cglib-2.2.jar, which were in the GWT 2.0 tools/lib directory, but there was no asm-attrs.jar; do you still need it? * When running an empty JUnit (*not* GWTTestCase) test, which just does loginViewMock=createMock(LoginView.class) I get another exception... The GWT.create( ) problem -- how did you handle it? Or did I miss a step in your article? You'd generally mock your LoginPresenter.Display interface (or however you called it, your probably have one; otherwise, here is when it is useful to have one ;-) ), not your LoginView, which uses widgets, which need GWTMockUtilities (but it does not always work: History for instance cannot be used in pure Java, even with GWTMockUtilities.disarm()). --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en -~--~~~~--~~--~--~---