Package dagger.hilt.android.testing
Annotation Type BindValueIntoMap
-
@Retention(CLASS) @Target(FIELD) public @interface BindValueIntoMap
An annotation that can be used on a test field to contribute the value into theSingletonComponent
as anIntoMap
for the given type. Example usage:
Here the map that contains all the bound elements (in this case "bar" and "baz") will be accessible to the entire application for your test.public class FooTest{ ... @BindValueIntoMap @MyMapKey(KEY1) String boundBar = "bar"; @BindValueIntoMap @MyMapKey(KEY2) String boundBaz = "baz"; ... }