Back to Exoplayer

AdditionalFailureInfo (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/testutil/AdditionalFailureInfo.html

latest2.7 KB
Original Source

Package com.google.android.exoplayer2.testutil

Class AdditionalFailureInfo

  • java.lang.Object

    • com.google.android.exoplayer2.testutil.AdditionalFailureInfo
  • All Implemented Interfaces:org.junit.rules.TestRule


@RequiresApi(19)
public final classAdditionalFailureInfoextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")implements org.junit.rules.TestRule

A JUnit Rule that attaches additional info to any errors/exceptions thrown by the test.

This is useful for tests where the line-number from a stacktrace doesn't provide enough detail about the failure, for example when an assertion fails inside a loop.

This can be preferable to many calls to Truth.assertWithMessage(String) because it will also add info to errors/exceptions that bubble out from the system-under-test.

Includes special handling for AssertionError to ensure that test failures are correctly distinguished from test errors (all other errors/exceptions).

Constructor Summary

Constructors | Constructor | Description | | --- | --- | | AdditionalFailureInfo() | |

Method Summary

All Methods Instance Methods Concrete Methods | Modifier and Type | Method | Description | | --- | --- | --- | | org.junit.runners.model.Statement | apply​(org.junit.runners.model.Statement base, org.junit.runner.Description description) | | | void | setInfo​(String info) | Sets the additional info to be added to any test failures. |

- 

Methods inherited from class java.lang.Object

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

Constructor Detail

- 

AdditionalFailureInfo

public AdditionalFailureInfo()

Method Detail

- 

setInfo

public void setInfo​(@Nullable[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")info)

Sets the additional info to be added to any test failures. Pass null to skip adding any additional info.

Can be called from any thread.

- 

apply

public org.junit.runners.model.Statement apply​(org.junit.runners.model.Statement base,
                                               org.junit.runner.Description description)

Specified by:apply in interface org.junit.rules.TestRule