-
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.
Retter opp feilen der vi ikke kunne oppdatere opplysninger (#27)
* Retter opp feilen der vi ikke kunne oppdatere opplysninger * Retter opp feilen der vi ikke kunne oppdatere opplysninger
- Loading branch information
Showing
8 changed files
with
84 additions
and
30 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
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
5 changes: 5 additions & 0 deletions
5
src/main/resources/db/migration/V1.0.27__opplysninger_timestamp.sql
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,5 @@ | ||
ALTER TABLE OPPLYSNINGER | ||
ADD COLUMN IF NOT EXISTS ts timestamp DEFAULT now() NOT NULL; | ||
|
||
ALTER TABLE OPPLYSNINGER | ||
DROP COLUMN AKTIV; |
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
40 changes: 40 additions & 0 deletions
40
src/test/kotlin/no/nav/bidrag/behandling/service/OpplysningerServiceTest.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 |
---|---|---|
@@ -1,18 +1,58 @@ | ||
package no.nav.bidrag.behandling.service | ||
|
||
import no.nav.bidrag.behandling.TestContainerRunner | ||
import no.nav.bidrag.behandling.database.datamodell.Behandling | ||
import no.nav.bidrag.behandling.database.datamodell.BehandlingType | ||
import no.nav.bidrag.behandling.database.datamodell.OpplysningerType | ||
import no.nav.bidrag.behandling.database.datamodell.SoknadFraType | ||
import no.nav.bidrag.behandling.database.datamodell.SoknadType | ||
import no.nav.bidrag.domain.enums.EngangsbelopType | ||
import org.junit.jupiter.api.Assertions.assertFalse | ||
import org.junit.jupiter.api.Test | ||
import org.springframework.beans.factory.annotation.Autowired | ||
import java.util.Date | ||
import kotlin.test.assertEquals | ||
import kotlin.test.assertTrue | ||
|
||
class OpplysningerServiceTest : TestContainerRunner() { | ||
@Autowired | ||
lateinit var opplysningerService: OpplysningerService | ||
|
||
@Autowired | ||
lateinit var behandlingService: BehandlingService | ||
|
||
@Test | ||
fun `hente opplysninger`() { | ||
val res = opplysningerService.hentSistAktiv(1, OpplysningerType.BOFORHOLD) | ||
assertFalse(res.isPresent) | ||
} | ||
|
||
@Test | ||
fun `skal være bare en rad med aktive opplysninger`() { | ||
val b = behandlingService.createBehandling( | ||
Behandling( | ||
BehandlingType.FORSKUDD, | ||
SoknadType.FASTSETTELSE, | ||
Date(1), | ||
Date(2), | ||
Date(2), | ||
"123", | ||
123L, | ||
null, | ||
"ENH1", | ||
SoknadFraType.VERGE, | ||
engangsbelopType = EngangsbelopType.ETTERGIVELSE, | ||
stonadType = null, | ||
), | ||
) | ||
val opp1 = opplysningerService.opprett(b.id!!, OpplysningerType.BOFORHOLD, "data", Date(1)) | ||
val opp2 = opplysningerService.opprett(b.id!!, OpplysningerType.BOFORHOLD, "data", Date(1)) | ||
val opp4 = opplysningerService.opprett(b.id!!, OpplysningerType.BOFORHOLD, "data", Date(1)) | ||
val opp3 = opplysningerService.opprett(b.id!!, OpplysningerType.INNTEKTSOPPLYSNINGER, "data", Date(1)) | ||
|
||
val option = opplysningerService.hentSistAktiv(b.id!!, OpplysningerType.BOFORHOLD) | ||
|
||
assertTrue(option.isPresent) | ||
assertEquals(opp4.id, option.get().id) | ||
} | ||
} |