0

ZATS: NoSuchMethodError getContextPath()

asked 2013-02-07 00:22:28 +0800

alvaroromero gravatar image alvaroromero
0

Hi everyone,

I have this code

package finder.ui.demo;

import static org.junit.Assert.assertEquals;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.zkoss.zats.mimic.Client;
import org.zkoss.zats.mimic.ComponentAgent;
import org.zkoss.zats.mimic.DefaultZatsEnvironment;
import org.zkoss.zats.mimic.DesktopAgent;
import org.zkoss.zul.Label;

public class UnitTestDemoTest
{

   private static DefaultZatsEnvironment env;

   @BeforeClass
   public static void init()
   {
      env = new DefaultZatsEnvironment("./src/main/webapp/WEB-INF");
      env.init("./src/main/webapp/");
   }

   @AfterClass
   public static void end()
   {
      env.destroy();
   }

   @After
   public void after()
   {
      env.cleanup();
   }

   @Test
   public void btnLblHello()
   {
      Client client = env.newClient();
      DesktopAgent desktop = client.connect("/finder/UnitTestDemo.zul");

      ComponentAgent button = desktop.query("btnHello");
      ComponentAgent label = desktop.query("lblHello");

      button.click();
      assertEquals("Hello - Goodbye", label.as(Label.class).getValue());
   }

}

When I try run the junit throws this exception:

org.zkoss.zats.mimic.impl.emulator.EmulatorException: at org.zkoss.zats.mimic.impl.emulator.JettyEmulator.<init>(JettyEmulator.java:143) at org.zkoss.zats.mimic.impl.emulator.EmulatorBuilder.create(EmulatorBuilder.java:130) at org.zkoss.zats.mimic.DefaultZatsEnvironment.init(DefaultZatsEnvironment.java:86) at com.ellucian.degreeworks.finder.ui.demo.UnitTestDemoTest.init(UnitTestDemoTest.java:24) 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:597) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30) at org.junit.runners.ParentRunner.run(ParentRunner.java:300) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) 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: MultiException[java.lang.NoSuchMethodError: javax.servlet.ServletContext.getContextPath()Ljava/lang/String;, java.lang.IllegalStateException: !Selecting] at org.eclipse.jetty.server.Server.doStart(Server.java:254) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59) at org.zkoss.zats.mimic.impl.emulator.JettyEmulator.<init>(JettyEmulator.java:130) ... 19 more

I need to load using DefaultZatsEnvironment because I'm using spring

Please help me, I have several days with this bug.

Thanks

Alvaro Romero

delete flag offensive retag edit
Be the first one to answer this question!
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2013-02-07 00:22:28 +0800

Seen: 33 times

Last updated: Feb 07 '13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More