This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buildscript { | |
.... | |
ext.hilt_version = '2.28-alpha' | |
ext.hilt_jetpack_version = '1.0.0-alpha01' | |
.... | |
dependencies { | |
.... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.... | |
apply plugin: 'kotlin-kapt' | |
apply plugin: 'dagger.hilt.android.plugin' | |
.... | |
dependencies { | |
.... | |
implementation "androidx.hilt:hilt-lifecycle-viewmodel:$hilt_jetpack_version" | |
kapt "androidx.hilt:hilt-compiler:$hilt_jetpack_version" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@HiltAndroidApp | |
class HiltApplication : Application() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Module | |
@InstallIn(ApplicationComponent::class) | |
class NotificationServiceModule { | |
@Provides | |
@Singleton | |
fun provideNotificationManager(@ApplicationContext context: Context) = | |
context.getSystemService<NotificationManager>()!! | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@AndroidEntryPoint | |
class MainActivity : AppCompatActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
// AndroidInjection.inject(this) | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.... | |
dependencies { | |
.... | |
// Dagger | |
implementation "com.google.dagger:dagger:$dagger_version" | |
// implementation "com.google.dagger:dagger-android-support:$dagger_version" | |
kapt "com.google.dagger:dagger-compiler:$dagger_version" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
fun `given mock username when searchUser called then returns non-emptyList with the user`() = runTest { | |
// Given | |
val userName = MockData.userName | |
everySuspending { action.searchUser(isAny()) } returns Unit | |
every { store.getUsers() } returns flowOf(listOf(MockData.user)) | |
every { store.isFetchingFinished() } returns flowOf(true) | |
// When | |
viewModel.searchUser(userName) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GitHubUserListViewModelTest : TestsWithMocks() { | |
@Mock | |
lateinit var action: GitHubUserAction | |
@Mock | |
lateinit var store: GitHubUserStore | |
private val viewModel by withMocks { GitHubUserListViewModel(action, store) } | |
override fun setUpMocks() = injectMocks(mocker) |
OlderNewer