Skip to content

Most visited

Recently visited

navigation
Added in API level 1

ComparisonFailure

public class ComparisonFailure
extends AssertionFailedError

java.lang.Object
   ↳ java.lang.Throwable
     ↳ java.lang.Error
       ↳ java.lang.AssertionError
         ↳ junit.framework.AssertionFailedError
           ↳ junit.framework.ComparisonFailure


Thrown when an assert equals for Strings failed. Inspired by a patch from Alex Chaffee mailto:alex@purpletech.com

Summary

Public constructors

ComparisonFailure(String message, String expected, String actual)

Constructs a comparison failure.

Public methods

String getActual()

Gets the actual string value

String getExpected()

Gets the expected string value

String getMessage()

Returns "..." in place of common prefix and "..." in place of common suffix between expected and actual.

Inherited methods

From class java.lang.Throwable
From class java.lang.Object

Public constructors

ComparisonFailure

Added in API level 1
ComparisonFailure (String message, 
                String expected, 
                String actual)

Constructs a comparison failure.

Parameters
message String: the identifying message or null
expected String: the expected string value
actual String: the actual string value

Public methods

getActual

Added in API level 16
String getActual ()

Gets the actual string value

Returns
String the actual string value

getExpected

Added in API level 16
String getExpected ()

Gets the expected string value

Returns
String the expected string value

getMessage

Added in API level 1
String getMessage ()

Returns "..." in place of common prefix and "..." in place of common suffix between expected and actual.

Returns
String

See also:

This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.