//leakcanary/leakcanary/AndroidDetectLeaksAssert
AndroidDetectLeaksAssert¶
class AndroidDetectLeaksAssert(detectLeaksInterceptor: DetectLeaksInterceptor = AndroidDetectLeaksInterceptor(), heapAnalysisReporter: HeapAnalysisReporter = NoLeakAssertionFailedError.throwOnApplicationLeaks()) : DetectLeaksAssert
Default DetectLeaksAssert implementation. Uses public helpers so you should be able to create our own implementation if needed.
Leak detection can be skipped by annotating tests with SkipLeakDetection which requires the TestDescriptionHolder test rule be applied and evaluating when assertNoLeaks is called.
For improved leak detection, you should consider updating LeakCanary.Config.leakingObjectFinder to FilteringLeakingObjectFinder(AndroidObjectInspectors.appLeakingObjectFilters) when running in instrumentation tests. This changes leak detection from being incremental (based on AppWatcher to also scanning for all objects of known types in the heap).
Constructors¶
AndroidDetectLeaksAssert | fun AndroidDetectLeaksAssert(detectLeaksInterceptor: DetectLeaksInterceptor = AndroidDetectLeaksInterceptor(), heapAnalysisReporter: HeapAnalysisReporter = NoLeakAssertionFailedError.throwOnApplicationLeaks()) |
Types¶
Name | Summary |
---|---|
Companion | object Companion |
Functions¶
Name | Summary |
---|---|
assertNoLeaks | open override fun assertNoLeaks(tag: String) |