• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: JUnit4 testing of EOs: InvocationTargetException on subsequent runs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: JUnit4 testing of EOs: InvocationTargetException on subsequent runs


  • Subject: Re: JUnit4 testing of EOs: InvocationTargetException on subsequent runs
  • From: Paul Hoadley <email@hidden>
  • Date: Mon, 14 Dec 2009 16:56:38 +1030

On 14/12/2009, at 4:35 PM, M.Y. Tjoe wrote:

Anybody has any update on this issues? I am the next lucky winner for this one. I've updated to the latest Wonder library (2009-08-20) and using the latest Juint (4.8.1) but still have this problem. Tried ERXTestCase but that doesn't work for me. My test would not run at all which is good I guess. Also, I am using ERXMemoryAdaptor in the model so I don't know if this is not supported. Any help would be much appreciated.

I'm using JUnit4 and loading models manually when I need them.  There may be a better way.  In any case, in a superclass of all my test classes is this method:

public static void setUp(String modelName) {
try {
if (EOModelGroup.defaultGroup().modelNamed(modelName) == null) {
EOModel model =
new EOModel(new File("Resources/" + modelName
+ ".eomodeld").toURI().toURL());
EOModelGroup.defaultGroup().addModel(model);
}
} catch (MalformedURLException e) {
throw new RuntimeException("Could not load EO Model.");
}
}

That's called by the following method in the subclasses:

@BeforeClass
public static void setUp() {
setUp(MODEL_NAME);
}

Where MODEL_NAME is defined in the subclass to load the appropriate model.  Loading the models manually like this seems to be sufficient to initialise Wonder.  This appears on the console when I run any of these tests:

[2009-12-14 16:12:51 CST] <main> Initialized : er.extensions.ERXExtensions
[2009-12-14 16:12:51 CST] <main> Initialized : er.prototypes.ERPrototypes
[2009-12-14 16:12:51 CST] <main> Initialized : er.ajax.Ajax
[2009-12-14 16:12:51 CST] <main> Initialized : er.directtoweb.ERDirectToWeb
[2009-12-14 16:12:51 CST] <main> Initialized : er.javamail.ERJavaMail
[2009-12-14 16:12:51 CST] <main> Initialized : er.selenium.ERSelenium


Again, there may be a better way.  But ensuring a model was never loaded twice seemed to get rid of the InvocationTargetExceptions I was getting.


-- 
Paul.

w  http://logicsquad.net/
h  http://paul.hoadley.name/


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: JUnit4 testing of EOs: InvocationTargetException on subsequent runs
      • From: "M.Y. Tjoe" <email@hidden>
References: 
 >JUnit4 testing of EOs: InvocationTargetException on subsequent runs (From: Paul Hoadley <email@hidden>)
 >Re: JUnit4 testing of EOs: InvocationTargetException on subsequent runs (From: Paul Hoadley <email@hidden>)
 >Re: JUnit4 testing of EOs: InvocationTargetException on subsequent runs (From: Mike Schrag <email@hidden>)
 >Re: JUnit4 testing of EOs: InvocationTargetException on subsequent runs (From: Paul Hoadley <email@hidden>)
 >Re: JUnit4 testing of EOs: InvocationTargetException on subsequent runs (From: Q <email@hidden>)
 >Re: JUnit4 testing of EOs: InvocationTargetException on subsequent runs (From: Paul Hoadley <email@hidden>)
 >Re: JUnit4 testing of EOs: InvocationTargetException on subsequent runs (From: Q <email@hidden>)
 >Re: JUnit4 testing of EOs: InvocationTargetException on subsequent runs (From: "M.Y. Tjoe" <email@hidden>)

  • Prev by Date: Re: JUnit4 testing of EOs: InvocationTargetException on subsequent runs
  • Next by Date: Re: JUnit4 testing of EOs: InvocationTargetException on subsequent runs
  • Previous by thread: Re: JUnit4 testing of EOs: InvocationTargetException on subsequent runs
  • Next by thread: Re: JUnit4 testing of EOs: InvocationTargetException on subsequent runs
  • Index(es):
    • Date
    • Thread