How to test what an application writes to the console
Suppose you have to unit-test some Java code that writes to the console. Here's a way to do it:
Suppose you have to unit-test some Java code that writes to the console. Here's a way to do it:
Updated: you should check out this 40-minute presentation. The stuff below covers just one of his recommendations: testing code that changes often, in case your VCS is SVN.
Useful for autoboxing.
By default, Integer.valueOf caches between -128 and 127 (min/max. of signed byte). However, you can increase this range by using:
-XX:+AggressiveOpts
and/or
-Djava.lang.Integer.IntegerCache.high
when launching the VM.
More details: http://www.javaspecialists.eu/archive/Issue191.html
Our younger daughter, Kata, is a Java girl. If you ask her to put something down or stop playing with something, she just drops it and leaves it where it is. It's out of scope, and will be managed by the garbage collector...