Package com.crawljax.condition.invariant

Examples of com.crawljax.condition.invariant.Invariant


     * @see Invariant#Invariant(String, Condition)
     */
    public CrawlRulesBuilder addInvariant(String description, Condition condition) {
      Preconditions.checkNotNull(description);
      Preconditions.checkNotNull(condition);
      invariants.add(new Invariant(description, condition));
      return this;
    }
View Full Code Here


    // should never fail
    RegexCondition onInvariantsPagePreCondition = new RegexCondition(INVARIANT_TEXT);
    XPathCondition expectElement =
            new XPathCondition("//DIV[@id='SHOULD_ALWAYS_BE_ON_THIS_PAGE']");
    builder.crawlRules().addInvariant(
            new Invariant("testInvariantWithPrecondiions", expectElement,
                    onInvariantsPagePreCondition));
  }
View Full Code Here

     * @see Invariant#Invariant(String, Condition)
     */
    public CrawlRulesBuilder addInvariant(String description, Condition condition) {
      Preconditions.checkNotNull(description);
      Preconditions.checkNotNull(condition);
      invariants.add(new Invariant(description, condition));
      return this;
    }
View Full Code Here

     * @see Invariant#Invariant(String, Condition)
     */
    public CrawlRulesBuilder addInvariant(String description, Condition condition) {
      Preconditions.checkNotNull(description);
      Preconditions.checkNotNull(condition);
      invariants.add(new Invariant(description, condition));
      return this;
    }
View Full Code Here

    StateVertex state2 = new StateVertexImpl(2, "state2", "<table><div>state2</div></table>");
    StateVertex state3 = new StateVertexImpl(3, "state3", "<table><div>state2</div></table>");

    hit = false;
    ImmutableList<Invariant> iList =
            ImmutableList.of(new Invariant("Test123", new Condition() {

              @Override
              public boolean check(EmbeddedBrowser browser) {
                hit = true;
                return false;
View Full Code Here

      @Override
      public void onInvariantViolation(Invariant invariant, CrawlerContext context) {
        hit = true;
      }
    });
    builder.crawlRules().addInvariant(new Invariant("Test123", new Condition() {

      @Override
      public boolean check(EmbeddedBrowser browser) {
        return false;
      }
View Full Code Here

    assertThat(counterFor(OnNewStatePlugin.class), is(1));
  }

  @Test
  public void invariantViolatedIsCalled() throws Exception {
    Invariant invariant = mock(Invariant.class);
    plugins.runOnInvariantViolationPlugins(invariant, context);
    verify(invariantViolationPlugin).onInvariantViolation(invariant, context);
    assertThat(counterFor(OnInvariantViolationPlugin.class), is(1));
  }
View Full Code Here

    // should never fail
    RegexCondition onInvariantsPagePreCondition = new RegexCondition(INVARIANT_TEXT);
    XPathCondition expectElement =
      new XPathCondition("//DIV[@id='SHOULD_ALWAYS_BE_ON_THIS_PAGE']");
    builder.crawlRules().addInvariant(
      new Invariant("testInvariantWithPrecondiions", expectElement,
      onInvariantsPagePreCondition));
  }
View Full Code Here

   *            the description of the invariant.
   * @param condition
   *            the condition to be met.
   */
  public void addInvariant(String description, Condition condition) {
    this.invariants.add(new Invariant(description, condition));
  }
View Full Code Here

   *            the invariant condition.
   * @param preConditions
   *            the precondition.
   */
  public void addInvariant(String description, Condition condition, Condition... preConditions) {
    this.invariants.add(new Invariant(description, condition, preConditions));
  }
View Full Code Here

TOP

Related Classes of com.crawljax.condition.invariant.Invariant

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.