- Common ways to obtain WebService$Action
private void myMethod () {WebService$Action w =
WebService.Controller webServiceController;String actionKey;webServiceController.action(actionKey)
- Smart code suggestions by Codota
}
private void initWebServiceEngine(WsUrl... wsUrls) { List<WebService.Controller> controllers = new ArrayList<>(); for (WsUrl wsUrl : wsUrls) { String controller = wsUrl.getController(); WebService.Controller wsController = mock(WebService.Controller.class); when(wsController.path()).thenReturn(controller); List<WebService.Action> actions = new ArrayList<>(); for (String action : wsUrl.getActions()) { WebService.Action wsAction = mock(WebService.Action.class); when(wsAction.path()).thenReturn(controller + "/" + action); when(wsAction.key()).thenReturn(action); when(wsAction.handler()).thenReturn(wsUrl.getRequestHandler()); actions.add(wsAction); } when(wsController.actions()).thenReturn(actions); controllers.add(wsController); } when(webServiceEngine.controllers()).thenReturn(controllers); underTest = new WebServiceFilter(webServiceEngine, runtime); }
assertThat(showAction.isPost()).isFalse(); assertThat(showAction.isInternal()).isFalse(); assertThat(showAction.path()).isEqualTo("api/metric/show"); WebService.Action createAction = controller.action("create"); assertThat(createAction).isNotNull();
private static Function<WebService.Action, String> toPath() { return action -> "/" + action.path() + ".*"; }
private static Function<WebService.Action, String> toPath() { return action -> "/" + action.path() + ".*"; }