org.apache.jmeter.assertions

## Class AssertionResult

- java.lang.Object
- - org.apache.jmeter.assertions.AssertionResult

- All Implemented Interfaces:
    java.io.Serializable, Searchable
  Direct Known Subclasses:
    CompareAssertionResult

      public class AssertionResult
      extends java.lang.Object
      implements java.io.Serializable, Searchable

  Implements Response Assertion checking.
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `RESPONSE_WAS_NULL`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AssertionResult()` Deprecated. - use the named constructor
    `AssertionResult(java.lang.String name)` Create a new Assertion Result.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `getFailureMessage()` Get the message associated with any failure or error.
    `java.lang.String` | `getName()` Get the name of the assertion
    `java.util.List<java.lang.String>` | `getSearchableTokens()` Get a list of all tokens that should be visible to searching
    `boolean` | `isError()` Check if an error occurred while checking the assertion.
    `boolean` | `isFailure()` Check if the assertion failed.
    `void` | `setError(boolean e)` Set the flag indicating whether or not an error occurred while evaluating assertion failure clause.
    `void` | `setFailure(boolean f)` Set the flag indicating whether or not a failure occurred.
    `void` | `setFailureMessage(java.lang.String message)` Set the failure message giving more details about a failure or error.
    `AssertionResult` | `setResultForFailure(java.lang.String message)` Convenience method for setting up failed results
    `AssertionResult` | `setResultForNull()` Convenience method for setting up results where the response was null
    `java.lang.String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### RESPONSE_WAS_NULL

          public static final java.lang.String RESPONSE_WAS_NULL

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### AssertionResult

          @Deprecated
          public AssertionResult()

      Deprecated. - use the named constructor
      Create a new Assertion Result. The result will indicate no failure or error.

    - #### AssertionResult

          public AssertionResult(java.lang.String name)

      Create a new Assertion Result. The result will indicate no failure or error.
      Parameters:
        `name` - the name of the assertion

  - ### Method Detail

    - #### getName

          public java.lang.String getName()

      Get the name of the assertion
      Returns:
        the name of the assertion

    - #### isFailure

          public boolean isFailure()

      Check if the assertion failed. If it failed, the failure message may give more details about the failure.
      Returns:
        true if the assertion failed, false if the sample met the assertion criteria

    - #### isError

          public boolean isError()

      Check if an error occurred while checking the assertion. If an error occurred, the failure message may give more details about the error.
      Returns:
        true if an error occurred while checking the assertion, false otherwise.

    - #### getFailureMessage

          public java.lang.String getFailureMessage()

      Get the message associated with any failure or error. This method may return null if no message was set.
      Returns:
        a failure or error message, or null if no message has been set

    - #### setError

          public void setError(boolean e)

      Set the flag indicating whether or not an error occurred while evaluating assertion failure clause.
      Parameters:
        `e` - true if an error occurred, false otherwise

    - #### setFailure

          public void setFailure(boolean f)

      Set the flag indicating whether or not a failure occurred.
      Parameters:
        `f` - true if a failure occurred, false otherwise

    - #### setFailureMessage

          public void setFailureMessage(java.lang.String message)

      Set the failure message giving more details about a failure or error.
      Parameters:
        `message` - the message to set

    - #### setResultForFailure

          public AssertionResult setResultForFailure(java.lang.String message)

      Convenience method for setting up failed results
      Parameters:
        `message` - the message to set
      Returns:
        this

    - #### setResultForNull

          public AssertionResult setResultForNull()

      Convenience method for setting up results where the response was null
      Returns:
        assertion result with appropriate fields set up

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### getSearchableTokens

          public java.util.List<java.lang.String> getSearchableTokens()
                                                               throws java.lang.Exception

      Description copied from interface: `Searchable`
      Get a list of all tokens that should be visible to searching
      Specified by:
        `getSearchableTokens` in interface `Searchable`
      Returns:
        List of searchable tokens
      Throws:
        `java.lang.Exception` - when something fails while getting the searchable tokens

Copyright © 1998-2019 Apache Software Foundation. All Rights Reserved.