Skip to content

Instantly share code, notes, and snippets.

@jonfazzaro
Created June 23, 2022 21:41
Show Gist options
  • Save jonfazzaro/1458c170fc390f120861e6d28ada2dd4 to your computer and use it in GitHub Desktop.
Save jonfazzaro/1458c170fc390f120861e6d28ada2dd4 to your computer and use it in GitHub Desktop.
Use this assertion to test if a Kotlin class has a HiltViewModel annotation.
import org.junit.jupiter.api.Assertions.assertNotNull
inline fun <reified T : Any> assertIsHiltViewModel() {
assertNotNull(Class.forName("${T::class.qualifiedName}_HiltModules"))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment