クラス XpathExpectationsHelper

java.lang.ObjectSE
org.springframework.test.util.XpathExpectationsHelper

public class XpathExpectationsHelper extends ObjectSE
XPath 式を介してアサーションを適用するためのヘルパークラス。
導入:
3.2
作成者:
Rossen Stoyanchev
  • コンストラクターの詳細

  • メソッドの詳細

    • getXpathExpression

      protected XPathExpressionSE getXpathExpression()
      コンパイルされた XPath 式を返します。
    • assertNode

      public void assertNode(byte[] content, @Nullable StringSE encoding, Matcher<? super NodeSE> matcher) throws ExceptionSE
      コンテンツを解析し、XPath 式を NodeSE として評価し、指定された Matcher<Node> でそれをアサートします。
      例外:
      ExceptionSE
    • assertNodeList

      public void assertNodeList(byte[] content, @Nullable StringSE encoding, Matcher<? super NodeListSE> matcher) throws ExceptionSE
      コンテンツを解析し、XPath 式を NodeListSE として評価し、指定された Matcher<NodeList> でそれをアサートします。
      例外:
      ExceptionSE
      導入:
      5.2.2
    • exists

      public void exists(byte[] content, @Nullable StringSE encoding) throws ExceptionSE
      XPath 式を適用し、結果のコンテンツが存在することをアサートします。
      例外:
      ExceptionSE - コンテンツの解析または式の評価が失敗した場合
    • doesNotExist

      public void doesNotExist(byte[] content, @Nullable StringSE encoding) throws ExceptionSE
      XPath 式を適用し、結果のコンテンツが存在しないことを表明します。
      例外:
      ExceptionSE - コンテンツの解析または式の評価が失敗した場合
    • assertNodeCount

      public void assertNodeCount(byte[] content, @Nullable StringSE encoding, Matcher<? super IntegerSE> matcher) throws ExceptionSE
      XPath 式を適用し、結果のコンテンツを特定の Hamcrest マッチャーでアサートします。
      例外:
      ExceptionSE - コンテンツの解析または式の評価が失敗した場合
    • assertNodeCount

      public void assertNodeCount(byte[] content, @Nullable StringSE encoding, int expectedCount) throws ExceptionSE
      XPath 式を適用し、結果のコンテンツを整数としてアサートします。
      例外:
      ExceptionSE - コンテンツの解析または式の評価が失敗した場合
    • assertString

      public void assertString(byte[] content, @Nullable StringSE encoding, Matcher<? super StringSE> matcher) throws ExceptionSE
      XPath 式を適用し、結果のコンテンツを特定の Hamcrest マッチャーでアサートします。
      例外:
      ExceptionSE - コンテンツの解析または式の評価が失敗した場合
    • assertString

      public void assertString(byte[] content, @Nullable StringSE encoding, StringSE expectedValue) throws ExceptionSE
      XPath 式を適用し、結果のコンテンツを文字列としてアサートします。
      例外:
      ExceptionSE - コンテンツの解析または式の評価が失敗した場合
    • assertNumber

      public void assertNumber(byte[] content, @Nullable StringSE encoding, Matcher<? super DoubleSE> matcher) throws ExceptionSE
      XPath 式を適用し、結果のコンテンツを特定の Hamcrest マッチャーでアサートします。
      例外:
      ExceptionSE - コンテンツの解析または式の評価が失敗した場合
    • assertNumber

      public void assertNumber(byte[] content, @Nullable StringSE encoding, DoubleSE expectedValue) throws ExceptionSE
      XPath 式を適用し、結果のコンテンツを Double としてアサートします。
      例外:
      ExceptionSE - コンテンツの解析または式の評価が失敗した場合
    • assertBoolean

      public void assertBoolean(byte[] content, @Nullable StringSE encoding, boolean expectedValue) throws ExceptionSE
      XPath 式を適用し、結果のコンテンツをブール値としてアサートします。
      例外:
      ExceptionSE - コンテンツの解析または式の評価が失敗した場合
    • evaluateXpath

      @Nullable public <T> T evaluateXpath(byte[] content, @Nullable StringSE encoding, ClassSE<T> targetClass) throws ExceptionSE
      XPath を評価し、結果の値を返します。
      パラメーター:
      content - 評価するコンテンツ
      encoding - 使用するエンコーディング (必要に応じて)
      targetClass - ターゲットクラス。Number、String、Boolean、org.w3c.Node、NodeList のいずれか
      例外:
      ExceptionSE - コンテンツの解析または式の評価が失敗した場合
      導入:
      5.1
    • parseXmlByteArray

      protected DocumentSE parseXmlByteArray(byte[] xml, @Nullable StringSE encoding) throws ExceptionSE
      指定された XML コンテンツを DocumentSE に解析します。
      パラメーター:
      xml - 解析するコンテンツ
      encoding - メタデータとして提供される場合、オプションのコンテンツエンコーディング (たとえば HTTP ヘッダー)
      戻り値:
      解析されたドキュメント
      例外:
      ExceptionSE
    • evaluateXpath

      @Nullable protected <T> T evaluateXpath(DocumentSE document, QNameSE evaluationType, ClassSE<T> expectedClass) throws XPathExpressionExceptionSE
      指定されたドキュメントに XPath 式を適用します。
      例外:
      XPathExpressionExceptionSE - 式の評価が失敗した場合