-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathHomeActivityBadRequestTest.kt
More file actions
37 lines (30 loc) · 1.15 KB
/
HomeActivityBadRequestTest.kt
File metadata and controls
37 lines (30 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package com.example.joao.photoscodechallenge.home
import com.example.joao.photoscodechallenge.AcceptanceTest
import com.example.joao.photoscodechallenge.RequestInterceptorMock
import com.example.joao.photoscodechallenge.di.Injector
import com.example.joao.photoscodechallenge.robots.robot
import com.example.joao.photoscodechallenge.ui.MainActivity
import com.example.joao.photoscodechallenge.webservice.exceptions.BadRequestException
import com.github.salomonbrys.kodein.Kodein
import com.github.salomonbrys.kodein.bind
import com.github.salomonbrys.kodein.provider
import okhttp3.Interceptor
import org.junit.Test
/**
* Created by Joao Alvares Neto on 07/05/2018.
*/
class HomeActivityBadRequestTest : AcceptanceTest<MainActivity>(MainActivity::class.java) {
@Test
fun testWithBadRequestState() {
startActivity()
robot {
} withBadRequest {
errorHasBeenShown()
}
}
override val testDependencies = Kodein.Module(allowSilentOverride = true) {
bind<Interceptor>(tag = Injector.REQUEST_INTERCEPTOR,overrides = true) with provider {
RequestInterceptorMock(BadRequestException())
}
}
}