Re: assertThrows(myObject).methodCall()

Thomas Mueller <[email protected]> Tue, 12 Jul 2011 08:50:05 +0200
Newsgroups gmane.comp.java.junit.devel
Message-ID <CAKpgiBbgKJQt+vH7Rw1ho5hx9-j_p1+9Bmivoz+j5qNZkok3jQ@mail.gmail.com>
Hi,

I started writing the class proxy generator. So far my code writes a
<ClassName>Proxy.java file, which is then compiled (and loaded using a
custom classloader). The source code detour works well and is simple
(240 lines, http://code.google.com/p/h2database/source/browse/trunk/h2/src/test/org/h2/test/utils/ProxyCodeGenerator.java),
but obviously requires a Java compiler (either the JDK, or the Eclipse
compiler; by the way Javac 1.5 requires "method(..) throws
*RuntimeException*" which is funny). The next step is to generate the
bytecode directly.

Would it be an option to re-use the Apache Harmony proxy generator
source code? Not "as is", but as a starting point. JUnit is "Common
Public License - v 1.0", is using the Apache license for this part an
option? If not, I could implement the bytecode generator myself (from
scratch), but that would be more work. Or I could search for another
project with a better license.

Regards,
Thomas

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2