mpo's Blog
StevenN
TomK
Matthew
Kika | Mosh
Wiki (off-bridge)
acoliver
Carsten
Ovidiu
More Matthew...
Sam
Sylvain
Jeff
Simon
Bob
Werner
Marcus
Torsten
Bertrand
>Company Home<
[The Relevance]
[The References]
[The Blog-World]

Subscribe to "Marc, himself, his blogs, and you reading them" in Radio UserLand.

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.




...the eternal try-out.

Marc, himself, his blogs, and you reading them
 woensdag 5 maart 2003

Junit Out of Loop

Struggling with bidirectional many-to-many relations in hibernate today I got myself into writing this hack to get junit tests be able to test across more then one thread. (useful for testing out ThreadLocalMaps I guessed?)

public void testSomething throws Throwable {
// code doing the preparation of the test
// typically inserting stuff in a DB
// some of these might set some variable, you'll need to declare
final Object referenceThing;
  final Throwable[] exceptionSpace = new Throwable[1]; 
  // making this an inner class makes it more readable I think 
Thread separateRun = new Thread() {
public void run() {
try {
// here you perform your test code and typically
// there is something like:
Object calculatedThing = whateverCall();
assertEquals("Quite unexpected",
referenceThing, calculatedThing);
} catch (Throwable t) {
exceptionSpace[0] = t;
}
}
};
separateRun.start();
separateRun.join();
  // this trick makes sure you don't miss out 
// on the AssertionError nested in the other thread.
if (exceptionSpace[0] != null) {
throw exceptionSpace[0];
}
}

Bad thing is that the resulting test shows no difference in my hibernate case... have to dig in some more...

5:31:36 PM    

Welcome, but don't feed the animals!

The fun thing about a blogging colleague, is that you get to see how ideas become blogs.

I actually wanted to show the world (in my blog), a recent post of my favourite hisitech employee: There was some poetry again, and loads of shared emotions: you should just have a look through the glass ;-)

So this is what happened next: Steven, the all knowing web-indexer, knew (of course) about the archive and looked up the address, and let his imagination go wild at the question 'And that while the list is still not open for public posts?'

Which makes me think about that piece of Bruggen-wisdom: "A sick mind [really] is a joy for ever."

2:59:22 PM    


March 2003
Sun Mon Tue Wed Thu Fri Sat
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Feb   Apr

Click here to visit the Radio UserLand website.
Click to see the XML version of this web page. Click here to send an email to the editor of this weblog.
© Copyright 2003 Marc Portier.
Last update: 27/11/2003; 11:29:49.