-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TB-90 Legg til eget endepunkt for å hente kun egenregistrerte data på…
… bygning (#125) * TB-90 Legg til eget endepunkt for å hente kun egenregistrerte data på bygning * add integration test and extract some common functionality for route tests * update utils for with packages and add value asserts for props * update naming and descriptions * better and more consistent wording for route docs
- Loading branch information
1 parent
962471e
commit 5f1f18f
Showing
5 changed files
with
273 additions
and
38 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
49 changes: 49 additions & 0 deletions
49
...integrationTest/kotlin/no/kartverket/matrikkel/bygning/v1/common/EgenregistreringUtils.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,49 @@ | ||
package no.kartverket.matrikkel.bygning.v1.common | ||
|
||
import assertk.Assert | ||
import assertk.assertions.isBetween | ||
import assertk.assertions.prop | ||
import no.kartverket.matrikkel.bygning.application.models.kodelister.AvlopKode | ||
import no.kartverket.matrikkel.bygning.application.models.kodelister.EnergikildeKode | ||
import no.kartverket.matrikkel.bygning.application.models.kodelister.OppvarmingKode | ||
import no.kartverket.matrikkel.bygning.application.models.kodelister.VannforsyningKode | ||
import no.kartverket.matrikkel.bygning.routes.v1.bygning.RegisterMetadataResponse | ||
import no.kartverket.matrikkel.bygning.routes.v1.egenregistrering.AvlopRegistreringRequest | ||
import no.kartverket.matrikkel.bygning.routes.v1.egenregistrering.BruksarealRegistreringRequest | ||
import no.kartverket.matrikkel.bygning.routes.v1.egenregistrering.BruksenhetRegistreringRequest | ||
import no.kartverket.matrikkel.bygning.routes.v1.egenregistrering.ByggeaarRegistreringRequest | ||
import no.kartverket.matrikkel.bygning.routes.v1.egenregistrering.EgenregistreringRequest | ||
import no.kartverket.matrikkel.bygning.routes.v1.egenregistrering.EnergikildeRegistreringRequest | ||
import no.kartverket.matrikkel.bygning.routes.v1.egenregistrering.OppvarmingRegistreringRequest | ||
import no.kartverket.matrikkel.bygning.routes.v1.egenregistrering.VannforsyningRegistreringRequest | ||
import java.time.Instant | ||
|
||
internal fun EgenregistreringRequest.Companion.validEgenregistrering() = EgenregistreringRequest( | ||
bygningId = 1L, | ||
eier = "31129956715", | ||
bruksenhetRegistreringer = listOf( | ||
BruksenhetRegistreringRequest( | ||
bruksenhetId = 1L, | ||
bruksarealRegistrering = BruksarealRegistreringRequest(125.0), | ||
byggeaarRegistrering = ByggeaarRegistreringRequest(2010), | ||
vannforsyningRegistrering = VannforsyningRegistreringRequest( | ||
VannforsyningKode.OffentligVannverk, | ||
), | ||
avlopRegistrering = AvlopRegistreringRequest( | ||
avlop = AvlopKode.OffentligKloakk, | ||
), | ||
energikildeRegistrering = EnergikildeRegistreringRequest( | ||
listOf(EnergikildeKode.Elektrisitet), | ||
), | ||
oppvarmingRegistrering = OppvarmingRegistreringRequest( | ||
listOf(OppvarmingKode.Elektrisk), | ||
), | ||
), | ||
), | ||
) | ||
|
||
internal fun Assert<RegisterMetadataResponse>.hasRegistreringstidspunktWithinThreshold(now: Instant): () -> Unit { | ||
return { | ||
prop(RegisterMetadataResponse::registreringstidspunkt).isBetween(now, now.plusSeconds(1)) | ||
} | ||
} |
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
Oops, something went wrong.