/**
* Tests whether setLinks does proper checking on the isolate's state.
*/
void testIsolateState() throws IsolateStartupException {
Isolate us = Isolate.currentIsolate();
Isolate them = new Isolate("com.sun.midp.links.Empty", null);
Link[] la = new Link[1];
boolean thrown;
la[0] = Link.newLink(us, us);
thrown = false;
try {
LinkPortal.setLinks(them, la);
} catch (IllegalStateException ise) {
thrown = true;
}
assertTrue("not started: setLinks should throw ISE", thrown);
them.start();
thrown = false;
try {
LinkPortal.setLinks(them, la);
} catch (IllegalStateException ise) {
thrown = true;
} finally {
LinkPortal.setLinks(them, null); // clean up
}
assertFalse("started: setLinks shouldn't throw ISE", thrown);
them.exit(0);
them.waitForExit();
thrown = false;
try {
LinkPortal.setLinks(them, la);
} catch (IllegalStateException ise) {
thrown = true;