forked from cobeisfresh/CleanArchitecture-Android-Showcase
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add dependencies for testing, write weather use case test, swap execute function in UseCase for overloaded invoke operator, update README.md
- Loading branch information
1 parent
f2209d1
commit ec1a469
Showing
13 changed files
with
63 additions
and
17 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.cobeisfresh | ||
|
||
import org.junit.runner.RunWith | ||
import org.mockito.junit.MockitoJUnitRunner | ||
|
||
@RunWith(MockitoJUnitRunner::class) | ||
class WeatherViewModelTest { | ||
|
||
} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package com.example.data | ||
|
||
const val OSIJEK_CITY_NAME="Osijek" |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package com.example.domain | ||
|
||
const val OSIJEK_CITY_NAME = "Osijek" |
27 changes: 27 additions & 0 deletions
27
domain/src/test/java/com/example/domain/WeatherUseCaseTest.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.example.domain | ||
|
||
import com.example.domain.interaction.weather.GetWeatherUseCaseImpl | ||
import com.example.domain.repository.WeatherRepository | ||
import com.nhaarman.mockitokotlin2.mock | ||
import com.nhaarman.mockitokotlin2.verify | ||
import com.nhaarman.mockitokotlin2.verifyBlocking | ||
import kotlinx.coroutines.runBlocking | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import org.junit.runners.JUnit4 | ||
import org.mockito.junit.MockitoJUnitRunner | ||
|
||
@RunWith(MockitoJUnitRunner::class) | ||
class WeatherUseCaseTest { | ||
|
||
private val weatherRepository: WeatherRepository = mock() | ||
private val getWeather by lazy { GetWeatherUseCaseImpl(weatherRepository) } | ||
|
||
@Test | ||
fun `test GetWeatherUseCase calls WeatherRepository`() { | ||
runBlocking { | ||
getWeather(OSIJEK_CITY_NAME) | ||
verify(weatherRepository).getWeatherForLocation(OSIJEK_CITY_NAME) | ||
} | ||
} | ||
} |
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