本文整理了Java中org.mozilla.zest.core.v1.ZestExpressionResponseTime
类的一些代码示例,展示了ZestExpressionResponseTime
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZestExpressionResponseTime
类的具体详情如下:
包路径:org.mozilla.zest.core.v1.ZestExpressionResponseTime
类名称:ZestExpressionResponseTime
[英]The Class ZestExpressionResponseTime.
[中]ZesteExpressionResponseTime课程。
代码示例来源:origin: mozilla/zest
@Test
public void testDeepCopyNoPointers() {
ZestExpressionResponseTime timeExpr = new ZestExpressionResponseTime(1000);
ZestExpressionResponseTime copy = timeExpr.deepCopy();
timeExpr.setGreaterThan(false);
timeExpr.setTimeInMs(5);
assertFalse(
copy.getTimeInMs() == timeExpr.getTimeInMs()
|| copy.isGreaterThan() == timeExpr.isGreaterThan());
}
代码示例来源:origin: mozilla/zest
@Override
public String toString() {
String expression =
(isInverse() ? "NOT " : "")
+ "Response Time "
+ (isGreaterThan() ? "> " : "< ")
+ timeInMs;
return expression;
}
}
代码示例来源:origin: mozilla/zest
@Override
public ZestExpressionResponseTime deepCopy() {
return new ZestExpressionResponseTime(timeInMs, greaterThan, isInverse());
}
代码示例来源:origin: mozilla/zest
@Test
public void testDeepCopy() {
ZestExpressionResponseTime timeExpr = new ZestExpressionResponseTime(1000, false, true);
ZestExpressionResponseTime copy = timeExpr.deepCopy();
assertTrue(copy.getTimeInMs() == timeExpr.getTimeInMs());
assertEquals(copy.isGreaterThan(), timeExpr.isGreaterThan());
assertEquals(copy.isInverse(), timeExpr.isInverse());
}
代码示例来源:origin: mozilla/zest
@Test
public void testDeepCopyNoPointer() {
ZestExpressionResponseTime timeExpr = new ZestExpressionResponseTime(100);
ZestExpressionResponseTime copy = timeExpr.deepCopy();
timeExpr.setTimeInMs(50);
assertTrue(timeExpr.getTimeInMs() != copy.getTimeInMs());
}
代码示例来源:origin: mozilla/zest
@Test
public void testSetTimeInMs() {
long time = 1000;
ZestExpressionResponseTime timeExpr = new ZestExpressionResponseTime(10);
timeExpr.setTimeInMs(time);
assertTrue(time == timeExpr.getTimeInMs());
}
代码示例来源:origin: mozilla/zest
public void testIsTrueDeepCopyDifferentGreaterThan() {
ZestExpressionResponseTime timeExpr = new ZestExpressionResponseTime(1000);
ZestExpressionResponseTime copy = timeExpr.deepCopy();
timeExpr.setGreaterThan(false);
ZestRuntime runtime = new TestRuntime(new ZestResponse(null, "", "", 100, 10));
assertTrue(timeExpr.isTrue(runtime) && !copy.isTrue(runtime));
}
}
代码示例来源:origin: mozilla/zest
@Test
public void testEvaluateGreaterThanIsInverse() {
ZestExpressionResponseTime timeExpTime = new ZestExpressionResponseTime(1000);
ZestResponse response = new ZestResponse(null, "", "", 200, 1000);
timeExpTime.setInverse(true);
timeExpTime.setGreaterThan(true);
assertTrue(timeExpTime.evaluate(new TestRuntime(response)));
}
代码示例来源:origin: mozilla/zest
@Test
public void testEvaluate() {
ZestExpressionResponseTime timeExpr = new ZestExpressionResponseTime(1000);
timeExpr.setGreaterThan(false);
ZestResponse response = new ZestResponse(null, "", "", 100, 10);
assertTrue(timeExpr.evaluate(new TestRuntime(response)));
}
代码示例来源:origin: mozilla/zest
@Test
public void testIsTrueGreaterThan() {
ZestExpressionResponseTime timeExpr = new ZestExpressionResponseTime(0);
timeExpr.setGreaterThan(true);
ZestResponse response = new ZestResponse(null, "", "", 200, 100);
assertTrue(timeExpr.isTrue(new TestRuntime(response)));
}
代码示例来源:origin: mozilla/zest
System.out.print(
"Response Time: "
+ (timeExpr.isGreaterThan() ? ">" : "<=")
+ timeExpr.getTimeInMs()
+ " ");
} else if (element instanceof ZestExpressionStatusCode) {
代码示例来源:origin: mozilla/zest
ZestExpressionRegex regex =
new ZestExpressionRegex(ZestVariables.RESPONSE_BODY, "54321");
ZestExpressionResponseTime time = new ZestExpressionResponseTime(100);
LinkedList<String> includeRegex = new LinkedList<>();
LinkedList<String> excludeRegex = new LinkedList<>();
ZestExpressionURL url = new ZestExpressionURL(includeRegex, excludeRegex);
url.setInverse(true);
time.setGreaterThan(true);
ZestExpression genericExp =
new ZestExpression() {
代码示例来源:origin: mozilla/zest
ZestExpressionAnd and = new ZestExpressionAnd();
and.addChildCondition(new ZestExpressionLength("response.body", 100, 200));
and.addChildCondition(new ZestExpressionResponseTime(1000));
and.addChildCondition(or);
and.addChildCondition(and.deepCopy());
内容来源于网络,如有侵权,请联系作者删除!