Mockito 用いてテストコードを書く際、引数に配列を取るメソッドを verifyStatic が上手くいかずに困っております。
以下のようなコードを書きましたところエラーになりました。
java
1Mockito.when(request.getRequestURI()).thenReturn("/"); 2Mockito.when(request.getMethod()).thenReturn("GET"); 3 4PowerMockito.verifyStatic(Applog.class, VerificationModeFactory.times(1)); 5Applog.info(eq("AAA000002I"), AdditionalMatchers.aryEq(new String[] { 6 request.getRequestURI(), 7 request.getMethod(), 8 anyString() 9}));
org.mockito.exceptions.misusing.InvalidUseOfMatchersException: Invalid use of argument matchers! 0 matchers expected, 1 recorded: -> at jp.jp_life.oc.c1.api.filter.HttpFilterTest.testDoFilter(HttpFilterTest.java:113) This exception may occur if matchers are combined with raw values: //incorrect: someMethod(anyObject(), "raw String"); When using matchers, all arguments have to be provided by matchers. For example: //correct: someMethod(anyObject(), eq("String by matcher"));
エラーを読み取るに、生値を指定しているのが悪いように見受けられます。
いくつかのパターンを試してみましたが、どのようなフォーマットで aryEq や eq を使えば良いかわかりませんでした。
フォーマットの指定仕方をご教示ください。

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/10/19 04:28