Skip to content
🤔 Documentation issue? Report it

//leakcanary/leakcanary/SkipLeakDetection

SkipLeakDetection

@Target(allowedTargets = [AnnotationTarget.CLASS, AnnotationTarget.FUNCTION])

annotation class SkipLeakDetection(val message: String, val assertionTags: String)

Annotation for skipping leak detection in a UI test that calls LeakAssertions.assertNoLeaks. This annotation is useful to skip a leak detection in a test until the leaks are fixed.

The check is performed by shouldSkipTest which is called by AndroidDetectLeaksAssert, which requires that the TestDescriptionHolder rule be applied and evaluating when LeakAssertions.assertNoLeaks is called.

message should contain an explanation of why leak detection is skipped, e.g. a reference to a filed issue.

The optional assertionTags allows finer grained filtering based on the tag value passed to LeakAssertions.assertNoLeaks. If assertionTags is empty, then the test will skip leak detection entirely. If assertionTags is not empty, then the test will skip leak detection for any call to LeakAssertions.assertNoLeaks with a tag value contained in assertionTags.

Constructors

SkipLeakDetection fun SkipLeakDetection(message: String, vararg assertionTags: String)

Types

Name Summary
Companion object Companion

Properties

Name Summary
assertionTags val assertionTags: Array<out String>
message val message: String