bwbUnit

必要が有ったので早速お試し。細かいようだけどメソッド検索失敗したら

java.lang.NullPointerException
at bwbunit.whitebox.PrivateProxyImpl.call(PrivateProxyImpl.java:155)
at bwbunit.whitebox.PrivateProxyImpl.call(PrivateProxyImpl.java:130)
at bwbunit.whitebox.PrivateProxyImpl.invoke(PrivateProxyImpl.java:106)

で落ちるのも問題が有ると認識した*1ので超簡易パッチ。

http://cvs.sourceforge.net/viewcvs.py/bwbunit/bwbunit/src/bwbunit/whitebox/PrivateProxyImpl.java?rev=1.1&view=autoより、


*** orig/PrivateProxyImpl.java Thu Mar 11 15:19:25 2004
--- new/PrivateProxyImpl.java Thu Mar 11 15:19:25 2004
***************
*** 151,156 ****
--- 151,169 ----
{
method = findMethod(methodName, argTypes);
}
+ if (method == null) {
+ //cannot find method,so throw NoSuchMethodException for your debug.
+ //prepare error arguments.
+ String argList = "";
+ if (argTypes != null) {
+ for (int i = 0;i < argTypes.length;i++ ) {
+ argList = argList + argTypes[i] +
+ ((i != argTypes.length - 1) ? ","
+ : "" );
+ }
+ }
+ throw new NoSuchMethodException("Method Not Found ["+ methodName +"("+ argList +")]" );
+ }

method.setAccessible(true); //make method callable.
をあてるだけでいいのかな。というか追加なんだけど。細かすぎてフィードバックすべきか悩む。と書いてみるてすと。

*1:原因わからなかったよ。今後も失敗しそう。