コード例 #1
0
  @Test
  public void shouldReturnFailedIfAttributeWithWrongTypeExists() {
    given(connector.getBody()).willReturn("{\"awesome_field\": true}");

    ExecuteResult result = c.execute(connector);

    assertEquals(ExecuteResult.FAILED, result);
  }
コード例 #2
0
  @Test
  public void shouldReturnOkIfAttributeWithRightTypeExists() {
    given(connector.getBody())
        .willReturn("{\"awesome_field\": \"Lorem Ipsum. Hello World! Fooooobar\"}");

    ExecuteResult result = c.execute(connector);

    assertEquals(ExecuteResult.OK, result);
  }
コード例 #3
0
  @Test
  public void shouldReturnFailedIfAttributeDoesNotExist() {
    given(connector.getBody())
        .willReturn("{\"not_so_awesome_field\": \"Lorem Ipsum. Hello World! Fooooobar\"}");

    ExecuteResult result = c.execute(connector);

    assertEquals(ExecuteResult.FAILED, result);
  }
コード例 #4
0
  @Test
  public void shouldReturnOkIfAttributeWithRightTypeExistsWithComplexStructure() {
    given(connector.getBody())
        .willReturn(
            "{\"awesome_field\": {\"foo\": \"Fooooobar.\","
                + "\"other\": [\"Lorem Ipsum.\", \"Hello World!\"]}}");
    c.setAttribute("awesome_field.foo");

    ExecuteResult result = c.execute(connector);

    assertEquals(ExecuteResult.OK, result);
  }