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

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

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

ZestConditional.<init>介绍

[英]Instantiates a new zest conditional.
[中]实例化一个新的热情条件。

代码示例

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

@Override
public ZestStatement deepCopy() {
  ZestConditional copy = new ZestConditional(getIndex());
  if (this.rootExpression != null) {
    copy.rootExpression = rootExpression.deepCopy();
  }
  for (ZestStatement stmt : ifStatements) {
    copy.ifStatements.add(stmt.deepCopy());
  }
  for (ZestStatement stmt : elseStatements) {
    copy.elseStatements.add(stmt.deepCopy());
  }
  copy.setEnabled(this.isEnabled());
  return copy;
}

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

@Test
public void testGetLast() {
  ZestLoopString loop = new ZestLoopString(values);
  for (int i = 0; i < 10; i++) {
    loop.addStatement(new ZestConditional());
  }
  loop.addStatement(new ZestLoopString(values));
  assertTrue(loop.getLast().getClass().equals(ZestLoopString.class));
}

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

@Test
public void testZestLoopStringStringArrayIntListOfZestStatement() {
  LinkedList<ZestStatement> statements = new LinkedList<>();
  int firstIndex = 3;
  for (int i = 0; i < firstIndex - 1; i++) {
    statements.add(new ZestConditional(i));
  }
  statements.add(new ZestLoopString(firstIndex, values));
  ZestLoopString loop = new ZestLoopString(firstIndex, values);
  int idx = 0;
  for (ZestStatement stmt : statements) {
    loop.addStatement(stmt);
    idx = stmt.getIndex();
  }
  boolean rightStmtPos = loop.getStatement(idx).getClass().equals(ZestLoopString.class);
  boolean rightSetSize = loop.getSet().size() == values.length;
  assertTrue("right statements position", rightStmtPos);
  assertTrue("right Set Size", rightSetSize);
}

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

/**
 * Method testDeepConditionals1.
 *
 * @throws Exception
 */
@Test
public void testDeepConditionals1() throws Exception {
  ZestConditional zc1 = new ZestConditional(new ZestExpressionRegex("BODY", ""));
  ZestConditional zc2 = new ZestConditional(new ZestExpressionRegex("BODY", ""));
  ZestRequest req1 = new ZestRequest();
  ZestRequest req2 = new ZestRequest();
  zc1.addIf(zc2);
  zc2.addIf(req1);
  zc1.addElse(req2);
  checkOrder(new ZestStatement[] {zc1, zc2, req1, req2, null});
}

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

/**
 * Method testDeepConditionals1.
 *
 * @throws Exception
 */
@Test
public void testDeepConditionals1() throws Exception {
  ZestConditional zc1 = new ZestConditional(new ZestExpressionRegex("BODY", ""));
  ZestConditional zc2 = new ZestConditional(new ZestExpressionRegex("BODY", ""));
  ZestRequest req1 = new ZestRequest();
  ZestRequest req2 = new ZestRequest();
  zc1.addIf(zc2);
  zc2.addIf(req1);
  zc1.addElse(req2);
  checkOrder(new ZestStatement[] {zc1, zc2, req1, req2, null});
}

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

/**
 * Method testMovingElseStatements.
 *
 * @throws Exception
 */
@Test
public void testMovingElseStatements() throws Exception {
  ZestConditional zc1 = new ZestConditional(new ZestExpressionRegex("BODY", ""));
  ZestRequest req1 = new ZestRequest();
  ZestRequest req2 = new ZestRequest();
  zc1.addElse(req1);
  zc1.addElse(req2);
  zc1.moveElse(0, req2);
  checkOrder(new ZestStatement[] {zc1, req2, req1, null});
}
/*

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

@Test
public void testDeepCopy() {
  ZestLoopString loop = new ZestLoopString(values);
  loop.addStatement(new ZestConditional());
  loop.addStatement(new ZestLoopString(values));
  loop.addStatement(new ZestActionFail());
  ZestLoopString copy = loop.deepCopy();
  assertTrue("same state", copy.getCurrentState().equals(loop.getCurrentState()));
}

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

/**
 * Method testMoveLastElse.
 *
 * @throws Exception
 */
@Test
public void testMoveLastElse() throws Exception {
  ZestConditional zc = new ZestConditional(new ZestExpressionRegex("BODY", ""));
  ZestRequest req1 = new ZestRequest();
  ZestRequest req2 = new ZestRequest();
  ZestRequest req3 = new ZestRequest();
  zc.addElse(req1);
  zc.addElse(req2);
  zc.addElse(req3);
  zc.moveElse(0, req3);
  checkOrder(new ZestStatement[] {zc, req3, req1, req2, null});
}

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

/**
 * Method testRemoveMiddleElse.
 *
 * @throws Exception
 */
@Test
public void testRemoveMiddleElse() throws Exception {
  ZestConditional zc = new ZestConditional(new ZestExpressionRegex("BODY", ""));
  ZestRequest req1 = new ZestRequest();
  ZestRequest req2 = new ZestRequest();
  ZestRequest req3 = new ZestRequest();
  zc.addElse(req1);
  zc.addElse(req2);
  zc.addElse(req3);
  zc.removeElse(req2);
  checkOrder(new ZestStatement[] {zc, req1, req3, null});
}

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

/**
 * Method testMoveSecondElse.
 *
 * @throws Exception
 */
@Test
public void testMoveSecondElse() throws Exception {
  ZestConditional zc = new ZestConditional(new ZestExpressionRegex("BODY", ""));
  ZestRequest req1 = new ZestRequest();
  ZestRequest req2 = new ZestRequest();
  ZestRequest req3 = new ZestRequest();
  zc.addElse(req1);
  zc.addElse(req2);
  zc.addElse(req3);
  zc.moveElse(2, req2);
  checkOrder(new ZestStatement[] {zc, req1, req3, req2, null});
}

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

/**
 * Method testRemoveLastIf.
 *
 * @throws Exception
 */
@Test
public void testRemoveLastIf() throws Exception {
  ZestConditional zc = new ZestConditional(new ZestExpressionRegex("BODY", ""));
  ZestRequest req1 = new ZestRequest();
  ZestRequest req2 = new ZestRequest();
  ZestRequest req3 = new ZestRequest();
  zc.addIf(req1);
  zc.addIf(req2);
  zc.addIf(req3);
  zc.removeIf(req3);
  checkOrder(new ZestStatement[] {zc, req1, req2, null});
}

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

/**
 * Method testRemoveMiddleIf.
 *
 * @throws Exception
 */
@Test
public void testRemoveMiddleIf() throws Exception {
  ZestConditional zc = new ZestConditional(new ZestExpressionRegex("BODY", ""));
  ZestRequest req1 = new ZestRequest();
  ZestRequest req2 = new ZestRequest();
  ZestRequest req3 = new ZestRequest();
  zc.addIf(req1);
  zc.addIf(req2);
  zc.addIf(req3);
  zc.removeIf(req2);
  checkOrder(new ZestStatement[] {zc, req1, req3, null});
}

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

/**
 * Method testRemoveFirstElse.
 *
 * @throws Exception
 */
@Test
public void testRemoveFirstElse() throws Exception {
  ZestConditional zc = new ZestConditional(new ZestExpressionRegex("BODY", ""));
  ZestRequest req1 = new ZestRequest();
  ZestRequest req2 = new ZestRequest();
  ZestRequest req3 = new ZestRequest();
  zc.addElse(req1);
  zc.addElse(req2);
  zc.addElse(req3);
  zc.removeElse(req1);
  checkOrder(new ZestStatement[] {zc, req2, req3, null});
}

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

/**
 * Method testMoveSecondElse.
 *
 * @throws Exception
 */
@Test
public void testMoveSecondElse() throws Exception {
  ZestConditional zc = new ZestConditional(new ZestExpressionRegex("BODY", ""));
  ZestRequest req1 = new ZestRequest();
  ZestRequest req2 = new ZestRequest();
  ZestRequest req3 = new ZestRequest();
  zc.addElse(req1);
  zc.addElse(req2);
  zc.addElse(req3);
  zc.moveElse(2, req2);
  checkOrder(new ZestStatement[] {zc, req1, req3, req2, null});
}

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

/**
 * Method testMoveFirstIf.
 *
 * @throws Exception
 */
@Test
public void testMoveFirstIf() throws Exception {
  ZestConditional zc = new ZestConditional(new ZestExpressionRegex("BODY", ""));
  ZestRequest req1 = new ZestRequest();
  ZestRequest req2 = new ZestRequest();
  ZestRequest req3 = new ZestRequest();
  zc.addIf(req1);
  zc.addIf(req2);
  zc.addIf(req3);
  zc.moveIf(2, req1);
  checkOrder(new ZestStatement[] {zc, req2, req3, req1, null});
}

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

/**
 * Method testMoveLastIf.
 *
 * @throws Exception
 */
@Test
public void testMoveLastIf() throws Exception {
  ZestConditional zc = new ZestConditional(new ZestExpressionRegex("BODY", ""));
  ZestRequest req1 = new ZestRequest();
  ZestRequest req2 = new ZestRequest();
  ZestRequest req3 = new ZestRequest();
  zc.addIf(req1);
  zc.addIf(req2);
  zc.addIf(req3);
  zc.moveIf(1, req3);
  checkOrder(new ZestStatement[] {zc, req1, req3, req2, null});
}

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

/**
 * Method testMoveFirstElse.
 *
 * @throws Exception
 */
@Test
public void testMoveFirstElse() throws Exception {
  ZestConditional zc = new ZestConditional(new ZestExpressionRegex("BODY", ""));
  ZestRequest req1 = new ZestRequest();
  ZestRequest req2 = new ZestRequest();
  ZestRequest req3 = new ZestRequest();
  zc.addElse(req1);
  zc.addElse(req2);
  zc.addElse(req3);
  zc.moveElse(1, req1);
  checkOrder(new ZestStatement[] {zc, req2, req1, req3, null});
}

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

/**
 * Method testMoveLastElse.
 *
 * @throws Exception
 */
@Test
public void testMoveLastElse() throws Exception {
  ZestConditional zc = new ZestConditional(new ZestExpressionRegex("BODY", ""));
  ZestRequest req1 = new ZestRequest();
  ZestRequest req2 = new ZestRequest();
  ZestRequest req3 = new ZestRequest();
  zc.addElse(req1);
  zc.addElse(req2);
  zc.addElse(req3);
  zc.moveElse(0, req3);
  checkOrder(new ZestStatement[] {zc, req3, req1, req2, null});
}

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

/**
 * Method testMoveSecondIf.
 *
 * @throws Exception
 */
@Test
public void testMoveSecondIf() throws Exception {
  ZestConditional zc = new ZestConditional(new ZestExpressionRegex("BODY", ""));
  ZestRequest req1 = new ZestRequest();
  ZestRequest req2 = new ZestRequest();
  ZestRequest req3 = new ZestRequest();
  zc.addIf(req1);
  zc.addIf(req2);
  zc.addIf(req3);
  checkOrder(new ZestStatement[] {zc, req1, req2, req3, null});
  zc.moveIf(0, req2);
  checkOrder(new ZestStatement[] {zc, req2, req1, req3, null});
}

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

/**
 * Method testMoveSecondIf.
 *
 * @throws Exception
 */
@Test
public void testMoveSecondIf() throws Exception {
  ZestConditional zc = new ZestConditional(new ZestExpressionRegex("BODY", ""));
  ZestRequest req1 = new ZestRequest();
  ZestRequest req2 = new ZestRequest();
  ZestRequest req3 = new ZestRequest();
  zc.addIf(req1);
  zc.addIf(req2);
  zc.addIf(req3);
  checkOrder(new ZestStatement[] {zc, req1, req2, req3, null});
  zc.moveIf(0, req2);
  checkOrder(new ZestStatement[] {zc, req2, req1, req3, null});
}

相关文章