XML Feeds

.

[java-dev] Re: Unit testing Java externals that call outlet()

Adam Murray adamjmurray at gmail.com
Sun Aug 12 17:10:59 MDT 2007


Quote: topher lafata wrote on Sun, 12 August 2007 04:32
----------------------------------------------------
> You don't even have to make a jni stub.just make your own version of 
> MaxObject that implements any of the methods your mxj class might be 
> calling.Include this class in your project instead of max.jar.
> 
----------------------------------------------------

I may end up doing this. It's a little annoying because there are a lot of methods in MaxObject to implement, and I am slightly concerned I may implement a method improperly. I don't know if this is realistic, but what if some day I have code that relies on getName() or getAttr() to make a decision, but my implementation always returns null or some bogus string. I really just want to change the behavior of the problem methods...

I also don't like that I'll probably have to do this more than once: for MspObject and who knows what else.

If I can figure out how to do it, the easiest solution may be to instrument max.jar when unit testing, and alter the bytecode such that problem calls like outlet() don't do anything. I believe I could use something like AspectJ to insert a return statement into the top of any method I want.

Are other people running into these problems or do most people not bother to write unit tests? Can anyone describe a setup  where unit testing is working inside the IDE?

Adam


More information about the java-dev mailing list