Revision control
Copy as Markdown
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
package org.mozilla.tv.firefox.utils
import org.mockito.Mockito
/**
* Matches anything that is non-null: use this when [Mockito.any] crashes.
*
* A normal [Mockito.any] is a nullable type, so this allows us to test non-null
* code.
*
*/
@Suppress("UNCHECKED_CAST")
fun <T> anyNonNull(): T {
// Internally, this calls static void method reportMatcher, which seems to
// set some class state. If this line is commented out, the function will
// not work
Mockito.any<T>()
return null as T
}