Closed GoogleCodeExporter closed 9 years ago
Please join our googlegroup and post questions there instead of filing a new
issue.
Original comment by johan.ha...@gmail.com
on 2 Dec 2008 at 12:01
I cannot get the error you're describing when I run it in Eclipse, how ever you
have
a small error in your test:
expectPrivate(retrMock, jniMeth, "param value").once().andStubReturn("result");
should be
expectPrivate(retrMock, jniMeth, "param value").andStubReturn("result");
The whole test can also be rewritten as this:
@RunWith(PowerMockRunner.class)
// don't load JNI lib; simulate
@SuppressStaticInitializationFor( { "MyClass" })
public class MyClassTest {
@Test
public void testMy_methode() throws Exception {
MyClass retrMock = createPartialMock(MyClass.class, "my_native_method");
// Fails after following line...
expectPrivate(retrMock, "my_native_method", "param value").andStubReturn("result");
replayAll();
String res = retrMock.my_method("param value");
verifyAll();
assertEquals("result", res);
}
}
I'll try from the command-line next.
Original comment by johan.ha...@gmail.com
on 2 Dec 2008 at 12:18
This is also the reason why your code fails in command-line.
java -cp
.;cglib-nodep-2.1_3.jar;easymock-2.4.jar;easymockclassextension-2.4.jar;junit-4.
5.jar;powermock-1.0-full.jar;javassist-
3.8.0.GA.jar org.junit.runner.JUnitCore MyClassTest
works when you remove the once() call. once() can only be used for void
methods. I
don't know why the error message is not reported in command-line though. Also
please
use the dependencies from the powermock-with-dependencies zip file (though I
think it
should work with the dependencies that you specified as well).
And please you the mailing list the next time. Good luck.
Original comment by johan.ha...@gmail.com
on 2 Dec 2008 at 12:30
OK,
Thanks a lot for your help.
Sorry for the newsgroup I hadn't seen/used... I should have drunken more
caffeine...
Anyway great stuff you've made!
Original comment by frederic.delanoy@gmail.com
on 3 Dec 2008 at 12:07
Original issue reported on code.google.com by
frederic.delanoy@gmail.com
on 29 Nov 2008 at 3:10Attachments: