■HandlerResultMatchersのメソッド一覧
| public ResultMatcher handlerType(final Class> type) | 呼び出されるControllerクラスを検証する |
実行例)Controllerクラスで"HelloController"クラスが呼び出される
MockMvcオブジェクト.perform(get("/")
.andExpect(handler().handlerType(HelloController.class)));
|
|
| public ResultMatcher methodCall(final Object obj) | Controllerクラスで呼び出されるメソッドを検証する (クラス名含む) |
実行例)クラスTestController.classのメソッドmethodA()が呼び出される
MockMvcオブジェクト.perform(get("/")
.andExpect(handler().methodCall(on(TestController.class).methodA()));
|
|
実行例)クラスTestController.classのメソッドmethodA(String)が呼び出される
MockMvcオブジェクト.perform(get("/")
.andExpect(handler().methodCall(on(TestController.class).methodA("")));
|
|
| public ResultMatcher methodName(final Matcher super String> matcher) | Controllerクラスで呼び出されるメソッドをMatcherを使って検証する |
実行例)ControllerクラスのメソッドmethodA()が呼び出される
MockMvcオブジェクト.perform(get("/")
.andExpect(handler().methodName(is("methodA"))));
|
|
| public ResultMatcher methodName(final String name) | Controllerクラスで呼び出されるメソッドを検証する |
実行例)ControllerクラスのメソッドmethodA()が呼び出される
MockMvcオブジェクト.perform(get("/")
.andExpect(handler().methodName("methodA")));
|
|
| public ResultMatcher method(final Method method) | Controllerクラスで呼び出されるメソッドを検証する |
実行例)クラスTestController.classのメソッドpostForm(String)が呼び出される
MockMvcオブジェクト.perform(get("/")
.andExpect(handler().method(HelloController.class.getMethod("postForm", String.class)));
|
|