Anyone using rspec 1.3 and stubbing Java methods?
I tried this on a java static that would hit the db and I don't want
that for these unit tests. It did not work as expected.
in my before block:
JavaClass.stub!(:staticJavaMethod).and_return(some_value)
I tried the ruby form of the method like :static_java_method. I tried
with or without .with(params).
Is it the java method signature part that does not allow this?
Anybody even attempt this? I've googled and jtestr looks to allow for
mocks and stubs, but I'm not familiar with jtestr and my initial
thought is yuk because the use of ant.
Thanks,
GregD
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
Only the Ruby side of things will see the stubbed method. Any Java
code will still call the real thing, unfortunately.
/Nick
>> Anyone using rspec 1.3 and stubbing Java methods?
The JtestR project supports stubbing some Java methods through Mocha,
which can be used with RSpec. The docs
(http://docs.codehaus.org/display/JTESTR/Mocks) weren't clear on
whether or not this includes static methods, but it may be worth a
try.
--Ian