Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: WOApplication.primeApplication() deprecated



Hi!

Thank you for answering!


4)
Until now we have used

WOApplication.primeApplication(
            NSBundle.mainBundle().bundlePath(), "Application");

in the setUp method of our junit testcases for WO apps.

NSBundle.mainBundle().bundlePath() is now deprecated, ref. <url:http://developer.apple.com/documentation/WebObjects/Reference/API/com/webobjects/foundation/NSBundle.html#bundlePath()>

What should we use instead in setUp?

Depends on what you are using it for now... WOApps should almost never need to invoke this. Can you describe a bit more what you are using it for now?




Hi!

We are using junit tests for our eo-classes.

In our setUp method we have to call primeApplication

    protected void setUp() throws Exception {
        super.setUp();
        editingContext().lock();
        WOApplication.primeApplication(
                NSBundle.mainBundle().bundlePath(), "Application");
    }


When not having the primeApplication statement there we got alot of strange errors when running our junit tests from ant or from inside eclipse, like a ClassCastException on (Application) WOApplication.application().


From what I have understood we have to tell our application to be ready and up and running in some way before running the tests and this is what primeApplication does when we not start the application "the normal way" but run unitests on one class.

Please let me know if you want me to describe more that I have do here. I didn't wrote more just to save some trees (well, bandwidth, I guess ppl don't print out emails :).


just a little btw:

If some of you out there don't know about unit testing you maybe you should run out and buy "Test Driven Development: By Example" by Kent Beck (see <url:http://www.amazon.com/exec/obidos/tg/detail/-/0321146530/103-1351737-2076641?v=glance>). Very usefull stuff. Makes programming even more fun! :)



-Kaj :)
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >WOApplication.primeApplication() deprecated (From: Christian Pekeler <email@hidden>)
 >Re: WOApplication.primeApplication() deprecated (From: Hsu <email@hidden>)
 >Re: WOApplication.primeApplication() deprecated (From: Christian Pekeler <email@hidden>)
 >Re: WOApplication.primeApplication() deprecated (From: Hsu <email@hidden>)
 >Re: WOApplication.primeApplication() deprecated (From: Kaj Hejer <email@hidden>)
 >Re: WOApplication.primeApplication() deprecated (From: Hsu <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.