Most visited

Recently visited

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 the detail message string of this Throwable instance (which may be null).

See also:

Hooray!