Tabnine Logo
org.hamcrest.xml
Code IndexAdd Tabnine to your IDE (free)

How to use org.hamcrest.xml

Best Java code snippets using org.hamcrest.xml (Showing top 20 results out of 315)

origin: org.hamcrest/hamcrest-all

private HasXPath(String xPathExpression, NamespaceContext namespaceContext, Matcher<String> valueMatcher, QName mode) {
  this.compiledXPath = compiledXPath(xPathExpression, namespaceContext);
  this.xpathString = xPathExpression;
  this.valueMatcher = valueMatcher;
  this.evaluationMode = mode;
}
origin: org.hamcrest/hamcrest-all

/**
 * Creates a matcher of {@link org.w3c.dom.Node}s that matches when the examined node contains a node
 * at the specified <code>xPath</code>, with any content.
 * <p/>
 * For example:
 * <pre>assertThat(xml, hasXPath("/root/something[2]/cheese"))</pre>
 * 
 * @param xPath
 *     the target xpath
 */
public static org.hamcrest.Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath) {
 return org.hamcrest.xml.HasXPath.hasXPath(xPath);
}
origin: hamcrest/JavaHamcrest

  /**
   * Creates a matcher of {@link org.w3c.dom.Node}s that matches when the examined node contains a node
   * at the specified <code>xPath</code> within the specified namespace context, with any content.
   * For example:
   * <pre>assertThat(xml, hasXPath("/root/something[2]/cheese", myNs))</pre>
   * 
   * @param xPath
   *     the target xpath
   * @param namespaceContext
   *     the namespace for matching nodes
   */
  public static Matcher<Node> hasXPath(String xPath, NamespaceContext namespaceContext) {
    return new HasXPath(xPath, namespaceContext, WITH_ANY_CONTENT, XPathConstants.NODE);
  }
}
origin: org.hamcrest/hamcrest-all

@Override
public boolean matchesSafely(Node item, Description mismatch) {
  return evaluated(item, mismatch)
      .and(NODE_EXISTS)
      .matching(valueMatcher);
}
origin: hamcrest/JavaHamcrest

  @Override
  public Iterator<String> getPrefixes(String namespaceURI) {
    HashSet<String> prefixes = new HashSet<String>();
    String prefix = getPrefix(namespaceURI);
    if (prefix != null) {
      prefixes.add(prefix);
    }
    return prefixes.iterator();
  }
};
origin: org.hamcrest/hamcrest-all

/**
 * Creates a matcher of {@link org.w3c.dom.Node}s that matches when the examined node contains a node
 * at the specified <code>xPath</code> within the specified namespace context, with any content.
 * <p/>
 * For example:
 * <pre>assertThat(xml, hasXPath("/root/something[2]/cheese", myNs))</pre>
 * 
 * @param xPath
 *     the target xpath
 * @param namespaceContext
 *     the namespace for matching nodes
 */
public static org.hamcrest.Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath, javax.xml.namespace.NamespaceContext namespaceContext) {
 return org.hamcrest.xml.HasXPath.hasXPath(xPath, namespaceContext);
}
origin: hamcrest/JavaHamcrest

/**
 * Creates a matcher of {@link org.w3c.dom.Node}s that matches when the examined node has a value at the
 * specified <code>xPath</code>, within the specified <code>namespaceContext</code>, that satisfies
 * the specified <code>valueMatcher</code>.
 * For example:
 * <pre>assertThat(xml, hasXPath("/root/something[2]/cheese", myNs, equalTo("Cheddar")))</pre>
 * 
 * @param xPath
 *     the target xpath
 * @param namespaceContext
 *     the namespace for matching nodes
 * @param valueMatcher
 *     matcher for the value at the specified xpath
 */
public static Matcher<Node> hasXPath(String xPath, NamespaceContext namespaceContext, Matcher<String> valueMatcher) {
  return new HasXPath(xPath, namespaceContext, valueMatcher, STRING);
}
origin: hamcrest/JavaHamcrest

private HasXPath(String xPathExpression, NamespaceContext namespaceContext, Matcher<String> valueMatcher, QName mode) {
  this.compiledXPath = compiledXPath(xPathExpression, namespaceContext);
  this.xpathString = xPathExpression;
  this.valueMatcher = valueMatcher;
  this.evaluationMode = mode;
}
origin: hamcrest/JavaHamcrest

@Override
public boolean matchesSafely(Node item, Description mismatch) {
  return evaluated(item, mismatch)
      .and(NODE_EXISTS)
      .matching(valueMatcher);
}
origin: org.hamcrest/hamcrest-all

/**
 * Creates a matcher of {@link org.w3c.dom.Node}s that matches when the examined node has a value at the
 * specified <code>xPath</code> that satisfies the specified <code>valueMatcher</code>.
 * <p/>
 * For example:
 * <pre>assertThat(xml, hasXPath("/root/something[2]/cheese", equalTo("Cheddar")))</pre>
 * 
 * @param xPath
 *     the target xpath
 * @param valueMatcher
 *     matcher for the value at the specified xpath
 */
public static org.hamcrest.Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath, org.hamcrest.Matcher<java.lang.String> valueMatcher) {
 return org.hamcrest.xml.HasXPath.hasXPath(xPath, valueMatcher);
}
origin: org.hamcrest/hamcrest-all

  /**
   * Creates a matcher of {@link org.w3c.dom.Node}s that matches when the examined node contains a node
   * at the specified <code>xPath</code> within the specified namespace context, with any content.
   * <p/>
   * For example:
   * <pre>assertThat(xml, hasXPath("/root/something[2]/cheese", myNs))</pre>
   * 
   * @param xPath
   *     the target xpath
   * @param namespaceContext
   *     the namespace for matching nodes
   */
  @Factory
  public static Matcher<Node> hasXPath(String xPath, NamespaceContext namespaceContext) {
    return new HasXPath(xPath, namespaceContext, WITH_ANY_CONTENT, XPathConstants.NODE);
  }
}
origin: hamcrest/JavaHamcrest

/**
 * Creates a matcher of {@link org.w3c.dom.Node}s that matches when the examined node contains a node
 * at the specified <code>xPath</code>, with any content.
 * For example:
 * <pre>assertThat(xml, hasXPath("/root/something[2]/cheese"))</pre>
 * 
 * @param xPath
 *     the target xpath
 */
public static org.hamcrest.Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath) {
 return org.hamcrest.xml.HasXPath.hasXPath(xPath);
}
origin: org.hamcrest/hamcrest-all

/**
 * Creates a matcher of {@link org.w3c.dom.Node}s that matches when the examined node has a value at the
 * specified <code>xPath</code>, within the specified <code>namespaceContext</code>, that satisfies
 * the specified <code>valueMatcher</code>.
 * <p/>
 * For example:
 * <pre>assertThat(xml, hasXPath("/root/something[2]/cheese", myNs, equalTo("Cheddar")))</pre>
 * 
 * @param xPath
 *     the target xpath
 * @param namespaceContext
 *     the namespace for matching nodes
 * @param valueMatcher
 *     matcher for the value at the specified xpath
 */
public static org.hamcrest.Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath, javax.xml.namespace.NamespaceContext namespaceContext, org.hamcrest.Matcher<java.lang.String> valueMatcher) {
 return org.hamcrest.xml.HasXPath.hasXPath(xPath, namespaceContext, valueMatcher);
}
origin: hamcrest/JavaHamcrest

/**
 * Creates a matcher of {@link org.w3c.dom.Node}s that matches when the examined node contains a node
 * at the specified <code>xPath</code>, with any content.
 * For example:
 * <pre>assertThat(xml, hasXPath("/root/something[2]/cheese"))</pre>
 * 
 * @param xPath
 *     the target xpath
 */
public static Matcher<Node> hasXPath(String xPath) {
  return hasXPath(xPath, NO_NAMESPACE_CONTEXT);
}
origin: hamcrest/JavaHamcrest

/**
 * Creates a matcher of {@link org.w3c.dom.Node}s that matches when the examined node contains a node
 * at the specified <code>xPath</code> within the specified namespace context, with any content.
 * For example:
 * <pre>assertThat(xml, hasXPath("/root/something[2]/cheese", myNs))</pre>
 * 
 * @param xPath
 *     the target xpath
 * @param namespaceContext
 *     the namespace for matching nodes
 */
public static org.hamcrest.Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath, javax.xml.namespace.NamespaceContext namespaceContext) {
 return org.hamcrest.xml.HasXPath.hasXPath(xPath, namespaceContext);
}
origin: hamcrest/JavaHamcrest

/**
 * Creates a matcher of {@link org.w3c.dom.Node}s that matches when the examined node has a value at the
 * specified <code>xPath</code> that satisfies the specified <code>valueMatcher</code>.
 * For example:
 * <pre>assertThat(xml, hasXPath("/root/something[2]/cheese", equalTo("Cheddar")))</pre>
 * 
 * @param xPath
 *     the target xpath
 * @param valueMatcher
 *     matcher for the value at the specified xpath
 */
public static Matcher<Node> hasXPath(String xPath, Matcher<String> valueMatcher) {
  return hasXPath(xPath, NO_NAMESPACE_CONTEXT, valueMatcher);
}
origin: hamcrest/JavaHamcrest

/**
 * Creates a matcher of {@link org.w3c.dom.Node}s that matches when the examined node has a value at the
 * specified <code>xPath</code> that satisfies the specified <code>valueMatcher</code>.
 * For example:
 * <pre>assertThat(xml, hasXPath("/root/something[2]/cheese", equalTo("Cheddar")))</pre>
 * 
 * @param xPath
 *     the target xpath
 * @param valueMatcher
 *     matcher for the value at the specified xpath
 */
public static org.hamcrest.Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath, Matcher<java.lang.String> valueMatcher) {
 return org.hamcrest.xml.HasXPath.hasXPath(xPath, valueMatcher);
}
origin: hamcrest/JavaHamcrest

/**
 * Creates a matcher of {@link org.w3c.dom.Node}s that matches when the examined node has a value at the
 * specified <code>xPath</code>, within the specified <code>namespaceContext</code>, that satisfies
 * the specified <code>valueMatcher</code>.
 * For example:
 * <pre>assertThat(xml, hasXPath("/root/something[2]/cheese", myNs, equalTo("Cheddar")))</pre>
 * 
 * @param xPath
 *     the target xpath
 * @param namespaceContext
 *     the namespace for matching nodes
 * @param valueMatcher
 *     matcher for the value at the specified xpath
 */
public static org.hamcrest.Matcher<org.w3c.dom.Node> hasXPath(java.lang.String xPath, javax.xml.namespace.NamespaceContext namespaceContext, Matcher<java.lang.String> valueMatcher) {
 return org.hamcrest.xml.HasXPath.hasXPath(xPath, namespaceContext, valueMatcher);
}
origin: org.hamcrest/hamcrest-all

/**
 * Creates a matcher of {@link org.w3c.dom.Node}s that matches when the examined node contains a node
 * at the specified <code>xPath</code>, with any content.
 * <p/>
 * For example:
 * <pre>assertThat(xml, hasXPath("/root/something[2]/cheese"))</pre>
 * 
 * @param xPath
 *     the target xpath
 */
@Factory
public static Matcher<Node> hasXPath(String xPath) {
  return hasXPath(xPath, NO_NAMESPACE_CONTEXT);
}
origin: org.hamcrest/hamcrest-all

/**
 * Creates a matcher of {@link org.w3c.dom.Node}s that matches when the examined node has a value at the
 * specified <code>xPath</code> that satisfies the specified <code>valueMatcher</code>.
 * <p/>
 * For example:
 * <pre>assertThat(xml, hasXPath("/root/something[2]/cheese", equalTo("Cheddar")))</pre>
 * 
 * @param xPath
 *     the target xpath
 * @param valueMatcher
 *     matcher for the value at the specified xpath
 */
@Factory
public static Matcher<Node> hasXPath(String xPath, Matcher<String> valueMatcher) {
  return hasXPath(xPath, NO_NAMESPACE_CONTEXT, valueMatcher);
}
org.hamcrest.xml

Most used classes

  • HasXPath
    Applies a Matcher to a given XML Node in an existing XML Node tree, specified by an XPath expression
  • HasXPathTest$1
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now