@Test
 public void define_controller() throws Exception {
   assertThat(controller).isNotNull();
   assertThat(controller.description()).isNotEmpty();
   assertThat(controller.since()).isEqualTo("4.2");
   assertThat(controller.actions()).hasSize(1);
 }
 @Test
 public void define_controller() throws Exception {
   WebService.Controller controller = tester.controller("api/action_plans");
   assertThat(controller).isNotNull();
   assertThat(controller.description()).isNotEmpty();
   assertThat(controller.actions()).hasSize(6);
 }
 @Test
 public void define_controller() throws Exception {
   WebService.Controller controller = tester.controller("api/permissions");
   assertThat(controller).isNotNull();
   assertThat(controller.description()).isNotEmpty();
   assertThat(controller.since()).isEqualTo("3.7");
   assertThat(controller.actions()).hasSize(2);
 }
  @Test
  public void define() {
    WebService.Controller controller = ws.controller("api/computation");

    assertThat(controller).isNotNull();
    assertThat(controller.description()).isNotEmpty();
    assertThat(controller.actions()).hasSize(3);
  }
Beispiel #5
0
  @Test
  public void action_pending_is_defined() {
    WsTester wsTester = new WsTester();
    WebService.NewController newController =
        wsTester.context().createController(DUMMY_CONTROLLER_KEY);

    underTest.define(newController);
    newController.done();

    WebService.Controller controller = wsTester.controller(DUMMY_CONTROLLER_KEY);
    assertThat(controller.actions()).extracting("key").containsExactly("pending");

    WebService.Action action = controller.actions().iterator().next();
    assertThat(action.isPost()).isFalse();
    assertThat(action.description()).isNotEmpty();
    assertThat(action.responseExample()).isNotNull();
  }
  @Test
  public void define() {
    WebService.Context context = new WebService.Context();
    ws.define(context);

    WebService.Controller controller = context.controller(ActivitiesWs.ENDPOINT);

    assertThat(controller).isNotNull();
    assertThat(controller.actions()).hasSize(1);
    assertThat(controller.action(SearchAction.SEARCH_ACTION)).isNotNull();
  }
Beispiel #7
0
  @Test
  public void action_update_is_defined() {
    WsTester wsTester = new WsTester();
    WebService.NewController newController =
        wsTester.context().createController(DUMMY_CONTROLLER_KEY);

    underTest.define(newController);
    newController.done();

    WebService.Controller controller = wsTester.controller(DUMMY_CONTROLLER_KEY);
    assertThat(controller.actions()).extracting("key").containsExactly(ACTION_KEY);

    WebService.Action action = controller.actions().iterator().next();
    assertThat(action.isPost()).isTrue();
    assertThat(action.description()).isNotEmpty();
    assertThat(action.responseExample()).isNull();

    assertThat(action.params()).hasSize(1);
    WebService.Param key = action.param(KEY_PARAM);
    assertThat(key).isNotNull();
    assertThat(key.isRequired()).isTrue();
    assertThat(key.description()).isNotNull();
  }