Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Help about JWebUnit

  1. #1
    Junior Member
    Join Date
    Jan 2012
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question Help about JWebUnit

    Hi..

    i am trying a JUnit Framework (JWebUnit) in my project and this link is my reference JWebUnit - Quick Start.

    but when i try code in snippet 1&2, exactly in this part (see code below) :

    @Test
    public void test1() {
    beginAt("home.xhtml");
    /*
    assertTitleEquals("Login");
    setTextField("username", "test");
    setTextField("password", "test123");
    submit();
    assertTitleEquals("Welcome, test!");
    */
    }


    i've got an error message like this :


    java.lang.NoSuchMethodError: org.apache.commons.lang.StringUtils.startsWithIgno reCase(Ljava/lang/String;Ljava/lang/String;)Z
    at com.gargoylesoftware.htmlunit.util.URLCreator$URLC reatorStandard.toUrlUnsafeClassic(URLCreator.java: 66)
    at com.gargoylesoftware.htmlunit.util.UrlUtils.toUrlU nsafe(UrlUtils.java:193)
    at com.gargoylesoftware.htmlunit.util.UrlUtils.toUrlS afe(UrlUtils.java:171)
    at com.gargoylesoftware.htmlunit.WebClient.<clinit>(W ebClient.java:162)
    at net.sourceforge.jwebunit.htmlunit.HtmlUnitTestingE ngineImpl.createWebClient(HtmlUnitTestingEngineImp l.java:804)
    at net.sourceforge.jwebunit.htmlunit.HtmlUnitTestingE ngineImpl.initWebClient(HtmlUnitTestingEngineImpl. java:813)
    at net.sourceforge.jwebunit.htmlunit.HtmlUnitTestingE ngineImpl.beginAt(HtmlUnitTestingEngineImpl.java:2 14)
    at net.sourceforge.jwebunit.junit.WebTester.beginAt(WebTester.java:226)
    at id.co.myproject.core.webapp.LoginTestCase.test1(Lo ginTestCase.java:28)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at org.junit.internal.runners.TestMethod.invoke(TestM ethod.java:59)
    at org.junit.internal.runners.MethodRoadie.runTestMet hod(MethodRoadie.java:98)
    at org.junit.internal.runners.MethodRoadie$2.run(Meth odRoadie.java:79)
    at org.junit.internal.runners.MethodRoadie.runBefores ThenTestThenAfters(MethodRoadie.java:87)
    at org.junit.internal.runners.MethodRoadie.runTest(Me thodRoadie.java:77)
    at org.junit.internal.runners.MethodRoadie.run(Method Roadie.java:42)
    at org.junit.internal.runners.JUnit4ClassRunner.invok eTestMethod(JUnit4ClassRunner.java:88)
    at org.junit.internal.runners.JUnit4ClassRunner.runMe thods(JUnit4ClassRunner.java:51)
    at org.junit.internal.runners.JUnit4ClassRunner$1.run (JUnit4ClassRunner.java:44)
    at org.junit.internal.runners.ClassRoadie.runUnprotec ted(ClassRoadie.java:27)
    at org.junit.internal.runners.ClassRoadie.runProtecte d(ClassRoadie.java:37)
    at org.junit.internal.runners.JUnit4ClassRunner.run(J Unit4ClassRunner.java:42)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:130)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunn erWithArgs(JUnit4IdeaTestRunner.java:71)
    at com.intellij.rt.execution.junit.JUnitStarter.prepa reStreamsAndStart(JUnitStarter.java:202)
    at com.intellij.rt.execution.junit.JUnitStarter.main( JUnitStarter.java:63)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at com.intellij.rt.execution.application.AppMain.main (AppMain.java:120)

    may anybody help me ?

  2. #2
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: Help about JWebUnit

    java.lang.NoSuchMethodError: org.apache.commons.lang.StringUtils.startsWithIgno reCase(Ljava/lang/String;Ljava/lang/String
    Please read this carefully....

  3. The Following User Says Thank You to Mr.777 For This Useful Post:

    illidan (January 9th, 2012)

  4. #3
    Junior Member
    Join Date
    Jan 2012
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Help about JWebUnit

    thanks Mr.777

    this error happens caused by HtmlUnit is using a method (startsWithIgnoreCase) from commons-lang that was introduced in commons-lang 2.4.

    so i upgraded my commons.lang.version to commong-lang 2.6.

    Problem solved.

  5. #4
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: Help about JWebUnit

    Mark the thread as SOLVED.

Tags for this Thread