本文整理了Java中org.mozilla.zest.core.v1.ZestExpressionRegex.<init>()
方法的一些代码示例,展示了ZestExpressionRegex.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZestExpressionRegex.<init>()
方法的具体详情如下:
包路径:org.mozilla.zest.core.v1.ZestExpressionRegex
类名称:ZestExpressionRegex
方法名:<init>
[英]Instantiates a new zest expression regex.
[中]实例化一个新的zest表达式regex。
代码示例来源:origin: mozilla/zest
@Test
public void testEvaluateAlone() {
new ZestExpressionRegex();
}
}
代码示例来源:origin: mozilla/zest
@Override
public ZestExpressionRegex deepCopy() {
return new ZestExpressionRegex(
this.getVariableName(), this.getRegex(), this.isCaseExact(), this.isInverse());
}
代码示例来源:origin: mozilla/zest
@Test
public void testIsLeaf() {
ZestExpressionRegex regex = new ZestExpressionRegex(ZestVariables.RESPONSE_BODY, "");
assertTrue(regex.isLeaf());
}
代码示例来源:origin: mozilla/zest
@Test
public void shouldEvaluateAlwaysToFalseWithNullRegex() {
// Given
String nullRegex = null;
String varName = "VarName";
ZestExpressionRegex expressionRegex = new ZestExpressionRegex(varName, nullRegex);
for (String varValue : Arrays.asList("", "Some value", "A\nB", "$", ".")) {
// When
boolean evalution = expressionRegex.evaluate(createRuntime(varName, varValue));
// Then
assertFalse("String \"" + varValue + "\" evaludated to false.", evalution);
}
}
代码示例来源:origin: mozilla/zest
@Test
public void testDeepCopySameLocation() {
ZestExpressionRegex regex = new ZestExpressionRegex(ZestVariables.RESPONSE_HEADER, "PING");
ZestExpressionRegex copy = regex.deepCopy();
assertTrue(regex.getVariableName().equals(copy.getVariableName()));
}
代码示例来源:origin: mozilla/zest
@Test
public void testDeepCopySameRegex() {
ZestExpressionRegex regex = new ZestExpressionRegex(ZestVariables.RESPONSE_BODY, "PING");
ZestExpressionRegex copy = regex.deepCopy();
assertTrue(regex.getRegex().equals(copy.getRegex()));
}
代码示例来源:origin: mozilla/zest
@Test
public void shouldAllowToSetNullRegex() {
// Given
String nullRegex = null;
ZestExpressionRegex regex = new ZestExpressionRegex("VarName", "");
// When
regex.setRegex(nullRegex);
// Then
assertTrue(regex.getRegex() == null);
}
代码示例来源:origin: mozilla/zest
@Test
public void testSetInverse() {
ZestExpressionRegex regex =
new ZestExpressionRegex(ZestVariables.RESPONSE_HEADER, "", false, false);
regex.setInverse(true);
assertTrue(regex.isInverse());
}
代码示例来源:origin: mozilla/zest
@Test
public void testDeepCopySameNoPointersRegex() {
ZestExpressionRegex regex = new ZestExpressionRegex(ZestVariables.RESPONSE_HEADER, "PING");
ZestExpressionRegex copy = regex.deepCopy();
copy.setRegex("PONG");
assertFalse(regex.getRegex().equals(copy.getRegex()));
}
代码示例来源:origin: mozilla/zest
@Test
public void testDeepCopySameNoPointersLocation() {
ZestExpressionRegex regex = new ZestExpressionRegex(ZestVariables.RESPONSE_HEADER, "PING");
ZestExpressionRegex copy = regex.deepCopy();
copy.setVariableName(ZestVariables.RESPONSE_BODY);
assertFalse(regex.getVariableName().equals(copy.getVariableName()));
}
代码示例来源:origin: mozilla/zest
@Test
public void testIsTrueNullHeader() {
ZestResponse response = new ZestResponse(null, null, null, 0, 0);
ZestExpressionRegex regex = new ZestExpressionRegex(ZestVariables.RESPONSE_HEADER, "");
assertFalse(regex.isTrue(new TestRuntime(response)));
}
代码示例来源:origin: mozilla/zest
@Test
public void testIsTrueHeader() {
ZestResponse response =
new ZestResponse(null, "123456header654321", "987654body456789", 200, 100);
ZestExpressionRegex regexExpr =
new ZestExpressionRegex(ZestVariables.RESPONSE_HEADER, "head");
assertTrue(regexExpr.isTrue(new TestRuntime(response)));
}
代码示例来源:origin: mozilla/zest
@Test
public void testIsTrueBody() {
ZestResponse response =
new ZestResponse(null, "123456header654321", "987654body456789", 200, 100);
ZestExpressionRegex regexExpr =
new ZestExpressionRegex(ZestVariables.RESPONSE_BODY, "body");
assertTrue(regexExpr.isTrue(new TestRuntime(response)));
}
代码示例来源:origin: mozilla/zest
@Test
public void testIsTrueNullBody() {
ZestResponse response = new ZestResponse(null, null, null, 0, 0);
ZestExpressionRegex regexExpr = new ZestExpressionRegex(ZestVariables.RESPONSE_BODY, "");
assertFalse(regexExpr.isTrue(new TestRuntime(response)));
}
代码示例来源: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
/**
* 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 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
/**
* 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
@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))));
}
内容来源于网络,如有侵权,请联系作者删除!