Package dagger.hilt.android.testing
Annotation Interface BindElementsIntoSet
An annotation that can be used on a test field to contribute the value into the
SingletonComponent
as an ElementsIntoSet
for the given type. Example usage:
public class FooTest{
...
@BindElementsIntoSet Set bindedSet = ImmutableSet.of("bar", "baz");
...
}
Here, bindedSet will be accessible to the entire application for your test. This is functionally
equivalent to installing the following module in your test:
@Module
@InstallIn
interface MyModule {
@Provides
@ElementsIntoSet
Set bindSet() {
return ImmutableSet.of("bar", "baz");
}
}
Also see BindValueIntoSet
, where you can gather individual elements into one set and bind
it to the application.