Package org.uispec4j.assertion

Examples of org.uispec4j.assertion.Assertion


      }
    };
  }

  public Assertion containsComponent(final ComponentMatcher matcher) {
    return new Assertion() {
      public void check() {
        AssertAdapter.assertTrue(getSwingComponents(matcher).length > 0);
      }
    };
  }
View Full Code Here


   * Checks that the panel contains a given non-editable text.
   * This method is mainly suited for checking displayed messages in popped-up dialogs.
   * NB: Only JLabel components are taken into account.
   */
  public Assertion containsLabel(final String text) {
    return new Assertion() {
      public void check() {
        Component[] result = getSwingComponents(and(fromClass(JLabel.class), displayedNameSubstring(text)));
        if (result.length == 0) {
          AssertAdapter.fail("No label found with text '" + text + "'");
        }
View Full Code Here

    UISpecAssert.assertTrue(isEditable());
    jComboBox.setSelectedItem(text);
  }

  public Assertion contentEquals(final String... expected) {
    return new Assertion() {
      public void check() {
        ArrayUtils.assertEquals(expected, getContent());
      }
    };
  }
View Full Code Here

  public Assertion contains(final String item) {
    return contains(new String[]{item});
  }

  public Assertion contains(final String... items) {
    return new Assertion() {
      public void check() {
        List content = Arrays.asList(getContent());
        for (String item : items) {
          if (!content.contains(item)) {
            AssertAdapter.fail("Item '" + item + "' not found - actual content:" + content);
View Full Code Here

  /**
   * Checks that the combo box displays the given value and that it shows no elements when expanded.
   */
  public Assertion isEmpty(final String displayedValue) {
    return new Assertion() {
      public void check() {
        if (jComboBox.getItemCount() != 0) {
          AssertAdapter.fail("Unexpected content: " + ArrayUtils.toString(getContent()));
        }
        AssertAdapter.assertEquals(displayedValue, getRenderedValue(-1));
View Full Code Here

      }
    };
  }

  public Assertion selectionEquals(final String selection) {
    return new Assertion() {
      public void check() {
        if (jComboBox.getSelectedItem() == null) {
          if (selection != null) {
            AssertAdapter.assertEquals(selection, getRenderedValue(-1));
          }
View Full Code Here

      }
    };
  }

  public Assertion isEditable() {
    return new Assertion() {
      public void check() {
        if (!jComboBox.isEditable()) {
          AssertAdapter.fail("The combo box is not editable");
        }
      }
View Full Code Here

   *
   * @param expectedValue an int between 0 and 100, or -1 if the status is undeterminate
   * @see #setPrecision
   */
  public Assertion completionEquals(final int expectedValue) {
    return new Assertion() {
      public void check() {
        if (expectedValue == -1) {
          AssertAdapter.assertTrue("The progress bar status is not undeterminate",
                                    jProgressBar.isIndeterminate());
          return;
View Full Code Here

  public Assertion isCompleted() {
    return completionEquals(100);
  }

  public Assertion displayedValueEquals(final String expectedProgressString) {
    return new Assertion() {
      public void check() {
        AssertAdapter.assertEquals(expectedProgressString, jProgressBar.getString());
      }
    };
  }
View Full Code Here

   * Checks that the text box contains a number of substrings, in a given order.
   * This method is useful for checking key information in the displayed string,
   * without being too dependent on the actual wording.
   */
  public Assertion textContains(final String... orderedTexts) {
    return new Assertion() {
      public void check() {
        String actual = handler.getText();
        int index = 0;
        for (String text : orderedTexts) {
          index = actual.indexOf(text, index);
View Full Code Here

TOP

Related Classes of org.uispec4j.assertion.Assertion

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.