lightbulb_outline Help shape the future of the Google Play Console, Android Studio, and Firebase. Start survey
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

Public constructors

ComparisonFailure

added in API level 1
public 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
public String getActual ()

Gets the actual string value

Returns
String the actual string value

getExpected

added in API level 16
public String getExpected ()

Gets the expected string value

Returns
String the expected string value

getMessage

added in API level 1
public 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).