@@ -4,10 +4,7 @@ import io.mockk.every
4
4
import io.mockk.mockk
5
5
import io.mockk.mockkStatic
6
6
import io.mockk.unmockkStatic
7
- import java.net.URI
8
- import no.nav.familie.integrasjoner.azure.domene.AzureAdBrukere
9
7
import no.nav.familie.integrasjoner.dokarkiv.client.domene.FerdigstillJournalPost
10
- import no.nav.familie.integrasjoner.felles.MDCOperations
11
8
import no.nav.familie.integrasjoner.felles.OppslagException
12
9
import no.nav.familie.log.mdc.MDCConstants.MDC_CALL_ID
13
10
import org.assertj.core.api.Assertions.assertThat
@@ -18,19 +15,20 @@ import org.junit.jupiter.api.Test
18
15
import org.junit.jupiter.api.assertThrows
19
16
import org.slf4j.MDC
20
17
import org.springframework.http.HttpEntity
21
- import org.springframework.http.HttpHeaders
22
18
import org.springframework.http.HttpMethod
23
19
import org.springframework.http.HttpStatus
24
20
import org.springframework.web.client.RestClientResponseException
25
21
import org.springframework.web.client.RestOperations
26
22
import org.springframework.web.client.exchange
23
+ import java.net.URI
27
24
28
25
class DokarkivRestClientTest {
29
26
private val restOperations: RestOperations = mockk()
30
- private val dokarkivRestClient: DokarkivRestClient = DokarkivRestClient (
31
- dokarkivUrl = URI (" http://localhost:8080/dokarkiv" ),
32
- restOperations = restOperations,
33
- )
27
+ private val dokarkivRestClient: DokarkivRestClient =
28
+ DokarkivRestClient (
29
+ dokarkivUrl = URI (" http://localhost:8080/dokarkiv" ),
30
+ restOperations = restOperations,
31
+ )
34
32
35
33
@BeforeEach
36
34
fun setUp () {
@@ -48,14 +46,15 @@ class DokarkivRestClientTest {
48
46
@Test
49
47
fun `skal kaste OppslagException ved feil mot dokarkiv` () {
50
48
// Arrange
51
- every { restOperations.exchange<String >(any<URI >(), eq(HttpMethod .PATCH ), any<HttpEntity <FerdigstillJournalPost >>()) } throws RestClientResponseException (
52
- " Noe gikk galt" ,
53
- HttpStatus .NOT_FOUND ,
54
- " bad request" ,
55
- null ,
56
- null ,
57
- null
58
- )
49
+ every { restOperations.exchange<String >(any<URI >(), eq(HttpMethod .PATCH ), any<HttpEntity <FerdigstillJournalPost >>()) } throws
50
+ RestClientResponseException (
51
+ " Noe gikk galt" ,
52
+ HttpStatus .NOT_FOUND ,
53
+ " bad request" ,
54
+ null ,
55
+ null ,
56
+ null ,
57
+ )
59
58
60
59
// Act & Assert
61
60
val oppslagException = assertThrows<OppslagException > { dokarkivRestClient.ferdigstillJournalpost(" 1234" , " oslo" , " 4321" ) }
@@ -66,4 +65,4 @@ class DokarkivRestClientTest {
66
65
assertThat(oppslagException.httpStatus).isEqualTo(HttpStatus .INTERNAL_SERVER_ERROR )
67
66
}
68
67
}
69
- }
68
+ }
0 commit comments