gpt4 book ai didi

org.mozilla.zest.core.v1.ZestAssertion类的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 09:42:54 26 4
gpt4 key购买 nike

本文整理了Java中org.mozilla.zest.core.v1.ZestAssertion类的一些代码示例,展示了ZestAssertion类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZestAssertion类的具体详情如下:
包路径:org.mozilla.zest.core.v1.ZestAssertion
类名称:ZestAssertion

ZestAssertion介绍

[英]The Class ZestAssertion.
[中]这门课是ZestAssertion。

代码示例

代码示例来源:origin: mozilla/zest

@Override
  public ZestElement deepCopy() {
    return new ZestAssertion(rootExpression.deepCopy());
  }
}

代码示例来源:origin: mozilla/zest

/**
 * Method testSimpleIncRegex.
 *
 * @throws Exception
 */
@Test
public void testSimpleIncRegex() throws Exception {
  ZestExpressionRegex regex = new ZestExpressionRegex(ZestVariables.RESPONSE_BODY, "test123");
  ZestAssertion ze = new ZestAssertion(regex);
  assertTrue(ze.isValid(new TestRuntime(new ZestResponse(null, "", "aaaatest123", 200, 0))));
}

代码示例来源:origin: mozilla/zest

@Override
public void handleResponse(ZestRequest request, ZestResponse response)
    throws ZestAssertFailException, ZestActionFailException {
  boolean passed = true;
  for (ZestAssertion za : request.getAssertions()) {
    if (za.isValid(this)) {
      this.responsePassed(request, response, za);
    } else {
      passed = false;
      this.responseFailed(request, response, za);
    }
  }
  if (passed) {
    this.responsePassed(request, response);
  } else {
    this.responseFailed(request, response);
  }
}

代码示例来源:origin: mozilla/zest

System.out.println("Assert: " + za.getElementType());

代码示例来源:origin: mozilla/zest

@Override
public ZestRequest deepCopy() {
  ZestRequest zr = new ZestRequest(this.getIndex());
  zr.setUrl(this.url);
  zr.setUrlToken(this.urlToken);
  zr.setData(this.data);
  zr.setMethod(this.method);
  zr.setHeaders(this.headers);
  zr.setFollowRedirects(this.followRedirects);
  zr.setTimestamp(this.timestamp);
  if (this.getResponse() != null) {
    zr.setResponse(this.getResponse().deepCopy());
  }
  for (ZestAssertion zt : this.getAssertions()) {
    zr.addAssertion((ZestAssertion) zt.deepCopy());
  }
  for (ZestCookie cookie : this.cookies) {
    zr.addCookie(
        new ZestCookie(
            cookie.getDomain(),
            cookie.getName(),
            cookie.getValue(),
            cookie.getPath(),
            cookie.getExpiryDate(),
            cookie.isSecure()));
  }
  zr.setEnabled(this.isEnabled());
  return zr;
}

代码示例来源:origin: mozilla/zest

/**
 * Method testSimpleIncInvRegex.
 *
 * @throws Exception
 */
@Test
public void testSimpleIncInvRegex() throws Exception {
  ZestExpressionRegex regex =
      new ZestExpressionRegex(ZestVariables.RESPONSE_BODY, "test123", false, true);
  ZestAssertion ze = new ZestAssertion(regex);
  assertFalse(ze.isValid(new TestRuntime(new ZestResponse(null, "", "aaaatest123", 200, 0))));
}

代码示例来源:origin: mozilla/zest

/**
 * Method testSimpleExcRegex.
 *
 * @throws Exception
 */
@Test
public void testSimpleExcRegex() throws Exception {
  ZestExpressionRegex regex = new ZestExpressionRegex(ZestVariables.RESPONSE_BODY, "test123");
  ZestAssertion ze = new ZestAssertion(regex);
  assertFalse(ze.isValid(new TestRuntime(new ZestResponse(null, "", "aaaatst123", 200, 0))));
}

代码示例来源:origin: mozilla/zest

/**
   * Method testSimpleExcInvRegex.
   *
   * @throws Exception
   */
  @Test
  public void testSimpleExcInvRegex() throws Exception {
    ZestExpressionRegex regex =
        new ZestExpressionRegex(ZestVariables.RESPONSE_BODY, "test123", false, true);
    ZestAssertion ze = new ZestAssertion(regex);
    assertTrue(ze.isValid(new TestRuntime(new ZestResponse(null, "", "aaaatst123", 200, 0))));
  }
}

代码示例来源:origin: mozilla/zest

@Test
public void testSimpleCaseExact() throws Exception {
  ZestExpressionRegex regex =
      new ZestExpressionRegex(ZestVariables.RESPONSE_BODY, "test123", true, false);
  ZestAssertion ze = new ZestAssertion(regex);
  assertTrue(ze.isValid(new TestRuntime(new ZestResponse(null, "", "aaaatest123", 200, 0))));
  assertFalse(ze.isValid(new TestRuntime(new ZestResponse(null, "", "aaaaTest123", 200, 0))));
}

代码示例来源:origin: mozilla/zest

@Test
public void testSimpleCaseIgnore() throws Exception {
  ZestExpressionRegex regex =
      new ZestExpressionRegex(ZestVariables.RESPONSE_BODY, "test123", false, false);
  ZestAssertion ze = new ZestAssertion(regex);
  assertTrue(ze.isValid(new TestRuntime(new ZestResponse(null, "", "aaaatest123", 200, 0))));
  assertTrue(ze.isValid(new TestRuntime(new ZestResponse(null, "", "aaaaTest123", 200, 0))));
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com