Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7827523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T09:54:54+00:00 2026-06-02T09:54:54+00:00

So if I call any JUnit assertion which fails from inside a callback method

  • 0

So if I call any JUnit assertion which fails from inside a callback method I get this exception:

Mar 12, 2012 11:24:41 AM 

com.gargoylesoftware.htmlunit.javascript.background.JavaScriptJobManagerImpl runJob
SEVERE: Job run failed with unexpected RuntimeException: [object Class JavaObject] (injected script#14)
net.sourceforge.htmlunit.corejs.javascript.JavaScriptException: [object Class JavaObject] (injected script#14)
    at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1062)
    at script(injected script:14)
    at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:845)
    at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
    at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:429)
    at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:269)
    at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3162)
    at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
    at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:559)
    at com.gargoylesoftware.htmlunit.javascript.host.xml.XMLHttpRequest.setState(XMLHttpRequest.java:181)
    at com.gargoylesoftware.htmlunit.javascript.host.xml.XMLHttpRequest.doSend(XMLHttpRequest.java:525)
    at com.gargoylesoftware.htmlunit.javascript.host.xml.XMLHttpRequest.access$000(XMLHttpRequest.java:64)
    at com.gargoylesoftware.htmlunit.javascript.host.xml.XMLHttpRequest$1.run(XMLHttpRequest.java:461)
    at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:537)
    at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:538)
    at com.gargoylesoftware.htmlunit.javascript.host.xml.XMLHttpRequest$2.run(XMLHttpRequest.java:467)
    at com.gargoylesoftware.htmlunit.javascript.background.JavaScriptJobManagerImpl.runJob(JavaScriptJobManagerImpl.java:226)
    at com.gargoylesoftware.htmlunit.javascript.background.JavaScriptJobManagerImpl.runSingleJob(JavaScriptJobManagerImpl.java:307)
    at com.gargoylesoftware.htmlunit.javascript.background.JavaScriptExecutor.run(JavaScriptExecutor.java:182)
    at java.lang.Thread.run(Thread.java:722)

A simple test that produces this:

public void testSimple() {
    MyPrgrmServiceAsync serv = GWT.create(MyPrgrmService.class);
    serv.search("some query", new AsyncCallback<SearchResult>() {
        public void onSuccess(SearchResult sr) {
            fail();
        }

        public void onFailure(Throwable caught) {
            fail(caught.toString());
        }
    });

    delayTestFinish(60000);
}

When this test is run, it “passes” as far as the JUnit Runner is concerned with the green bar displayed in Eclipse, but obviously it’s supposed to fail. The only indication that anything went wrong is the exception in the console. If I move the fail() outside the callback, it fails normally and indicates so. Additionally, assertions that resolve to true behave normally, so it seems the test simply doesn’t know how to detect failures when they arise from within anonymous classes. Is there something I’m not understanding correctly about how to use JUnit assertions within callbacks/anonymous classes with respect to GWTTestCase?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T09:55:03+00:00Added an answer on June 2, 2026 at 9:55 am

    The problem was I was calling finishTest() in my gwtSetUp(). I was running some initialization code there which was an asynchronous method, and wanted to make sure it finished before the actual test code, but turns out it was just finishing the test before anything was actually tested. Moral of the story: Don’t be silly about your finishTest() placement.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way to call an action script function from an anchor which
I currently have the following code which allows me to call any method required
Say I have a function in JS function playerJob(job){} I call this method from
When I try to call any GL15 function in lwjgl I get A NullPointerException.
Using a delegate I can call any function asynchronously. From the documentation I understand
Getting sick with asp.net permission madness... This time, I Just cant AJAX-CALL any kind
I'm trying to allow a user to call any method on a server using
I call a method passing a parameter. If this parameter is equal to something
Using dynamic pattern perhaps? You can call any method/property using the dynamic keyword, right?
Is there any security problem with dynamically calling a method in a class from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.