org.mozilla.zest.core.v1.ZestExpressionURL.<init>()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(105)

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

ZestExpressionURL.<init>介绍

[英]Instantiates a new zest expression url.
[中]实例化一个新的zest表达式url。

代码示例

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

@Override
public ZestExpressionURL deepCopy() {
  ZestExpressionURL copy = new ZestExpressionURL();
  List<String> copyIncludeRegex = new ArrayList<>(includeRegexes);
  List<String> copyExcludeRegex = new ArrayList<>(excludeRegexes);
  copy.setIncludeRegexes(copyIncludeRegex);
  copy.setExcludeRegexes(copyExcludeRegex);
  copy.setInverse(isInverse());
  return copy;
}

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

@Test
  public void testIsTrueExcludePattern() {
    try {
      ZestResponse response =
          new ZestResponse(new URL("http://www.PONG19874.com"), "", "", 200, 100);
      ZestExpressionURL urlExpr = new ZestExpressionURL(includeStrings, excludeStrings);
      assertFalse(urlExpr.isTrue(new TestRuntime(response)));
    } catch (MalformedURLException e) {
      e.printStackTrace();
    }
  }
}

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

@Test
public void testZestExpressionURLListOfStringListOfString() {
  ZestExpressionURL urlExpr = new ZestExpressionURL(includeStrings, excludeStrings);
  for (int i = 0; i < includeSize; i++) {
    String obtained = urlExpr.getIncludeRegexes().get(i);
    String expected = "PING" + i;
    String msg = "INCLUDE Expected " + expected + " instead of" + obtained;
    assertTrue(msg, expected.equals(obtained));
  }
  for (int i = 0; i < excludeSize; i++) {
    String obtained = urlExpr.getExcludeRegexes().get(i);
    String expected = "PONG" + i;
    String msg = "EXCLUDE Expected " + expected + " instead of" + obtained;
    assertTrue(msg, expected.equals(obtained));
  }
}

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

@Test
public void testGetExcludeRegexes() {
  ZestExpressionURL urlExpr = new ZestExpressionURL();
  urlExpr.setExcludeRegexes(excludeStrings);
  urlExpr.setIncludeRegexes(includeStrings);
  List<String> excludeRegex = urlExpr.getExcludeRegexes();
  for (int i = 0; i < excludeSize; i++) {
    String obtained = excludeRegex.get(i);
    String expected = excludeStrings.get(i);
    String msg = "EXCLUDE: expected " + expected + " instead of " + obtained;
    assertTrue(msg, expected.equals(obtained));
  }
}

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

@Test
public void testGetIncludeRegexes() {
  ZestExpressionURL urlExpr = new ZestExpressionURL();
  urlExpr.setExcludeRegexes(excludeStrings);
  urlExpr.setIncludeRegexes(includeStrings);
  List<String> includeRegex = urlExpr.getIncludeRegexes();
  for (int i = 0; i < includeSize; i++) {
    String obtained = includeRegex.get(i);
    String expected = includeStrings.get(i);
    String msg = "INCLUDE: expected " + expected + " instead of " + obtained;
    assertTrue(msg, expected.equals(obtained));
  }
}

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

@Test
public void testDeepCopyNoPointer() {
  ZestExpressionURL urlExpr = new ZestExpressionURL(includeStrings, excludeStrings);
  ZestExpressionURL copy = urlExpr.deepCopy();
  urlExpr.setExcludeRegexes(null);
  urlExpr.setIncludeRegexes(null);
  for (int i = 0; i < includeSize; i++) {
    String obtained = copy.getIncludeRegexes().get(i);
    String msg = "INCLUDE: " + i;
    assertTrue(msg, includeStrings.get(i).equals(obtained));
  }
  for (int i = 0; i < excludeSize; i++) {
    String obtained = copy.getExcludeRegexes().get(i);
    String msg = "EXCLUDE: " + i;
    assertTrue(msg, excludeStrings.get(i).equals(obtained));
  }
}

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

@Test
public void testDeepCopy() {
  ZestExpressionURL urlExpr = new ZestExpressionURL(includeStrings, excludeStrings);
  urlExpr.setInverse(true);
  ZestExpressionURL copy = urlExpr.deepCopy();
  assertEquals(copy.isInverse(), urlExpr.isInverse());
  for (int i = 0; i < includeSize; i++) {
    String obtained = copy.getIncludeRegexes().get(i);
    String expected = includeStrings.get(i);
    String msg = "INCLUDE: expected " + expected + " instead of " + obtained;
    assertTrue(msg, expected.equals(obtained));
  }
  for (int i = 0; i < excludeSize; i++) {
    String obtained = copy.getExcludeRegexes().get(i);
    String expected = excludeStrings.get(i);
    String msg = "EXCLUDE: expected " + expected + " instead of " + obtained;
    assertTrue(msg, expected.equals(obtained));
  }
}

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

@Test
public void testIsTrueFalse() {
  ZestExpressionURL urlExpr = new ZestExpressionURL();
  urlExpr.setIncludeRegexes(includeStrings);
  urlExpr.setExcludeRegexes(excludeStrings);
  try {
    ZestRequest request = new ZestRequest();
    request.setUrl(new URL("http://www.PONG1.com"));
    assertFalse(urlExpr.isTrue(new TestRuntime(request)));
  } catch (MalformedURLException e) {
    e.printStackTrace();
  }
}

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

@Test
public void testIsTrueDifferentURL() {
  ZestExpressionURL urlExpr = new ZestExpressionURL();
  urlExpr.setIncludeRegexes(includeStrings);
  urlExpr.setExcludeRegexes(excludeStrings);
  try {
    ZestRequest request = new ZestRequest();
    request.setUrl(new URL("http://www.asdf.com"));
    assertFalse(urlExpr.isTrue(new TestRuntime(request)));
  } catch (MalformedURLException e) {
    e.printStackTrace();
  }
}

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

@Test
public void testIsTrue() {
  ZestExpressionURL urlExpr = new ZestExpressionURL();
  urlExpr.setIncludeRegexes(includeStrings);
  urlExpr.setExcludeRegexes(excludeStrings);
  try {
    ZestRequest request = new ZestRequest();
    request.setUrl(new URL("http://www.PING1.com"));
    assertTrue(urlExpr.isTrue(new TestRuntime(request)));
  } catch (MalformedURLException e) {
    e.printStackTrace();
  }
}

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

LinkedList<String> excludeRegex = new LinkedList<>();
excludeRegex.add("");
ZestExpressionURL url = new ZestExpressionURL(includeRegex, excludeRegex);
url.setInverse(true);
time.setGreaterThan(true);

相关文章