Example usage for android.util AndroidRuntimeException getMessage

List of usage examples for android.util AndroidRuntimeException getMessage

Introduction

In this page you can find the example usage for android.util AndroidRuntimeException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:com.albedinsky.android.support.intent.IntentBaseTest.java

static void assertBuildThrowsExceptionWithCause(BaseIntent intent, String cause) {
    try {/*  ww w. jav a2 s  . c o m*/
        intent.build();
    } catch (AndroidRuntimeException e) {
        final String message = "Cannot build " + intent.getClass().getSimpleName() + ". " + cause;
        final String eMessage = e.getMessage();
        if (!message.contentEquals(eMessage)) {
            throw new AssertionError(
                    "Expected exception with message <" + message + "> but message was <" + eMessage + ">");
        }
        return;
    }
    final String intentName = intent.getClass().getSimpleName();
    throw new AssertionError("No exception has been thrown while building intent(" + intentName + ").");
}