@@ -380,14 +380,15 @@ class DeltakerIntegrationTests : IntegrationTestBase() {
380
380
}
381
381
382
382
@Test
383
- fun `ignore deltaker before aktivitetsplan launch if tilDato before aktivitetsplan launch` () {
383
+ fun `ignore deltaker moddato before aktivitetsplan launch if tilDato before aktivitetsplan launch` () {
384
384
val (gjennomforingId, deltakerId) = setup()
385
385
val deltakerInput = DeltakerInput (
386
386
tiltakDeltakelseId = deltakerId,
387
387
tiltakgjennomforingId = gjennomforingId,
388
388
innsokBegrunnelse = " innsøkbegrunnelse" ,
389
389
endretAv = Ident (ident = " SIG123" ),
390
390
datoTil = AKTIVITETSPLAN_LANSERINGSDATO .toLocalDate().minusDays(1 ),
391
+ endretTidspunkt = AKTIVITETSPLAN_LANSERINGSDATO .minusDays(1 ),
391
392
registrertDato = AKTIVITETSPLAN_LANSERINGSDATO .minusDays(2 )
392
393
)
393
394
val deltakerCommand = NyDeltakerCommand (deltakerInput)
@@ -400,14 +401,15 @@ class DeltakerIntegrationTests : IntegrationTestBase() {
400
401
}
401
402
402
403
@Test
403
- fun `ignore deltaker before aktivitetsplan launch if tilDato after aktivitetplan launch, but no oppfolgingsperiode` () {
404
+ fun `ignore deltaker moddato before aktivitetsplan launch if tilDato after aktivitetplan launch, but no oppfolgingsperiode` () {
404
405
val (gjennomforingId, deltakerId) = setup()
405
406
val deltakerInput = DeltakerInput (
406
407
tiltakDeltakelseId = deltakerId,
407
408
tiltakgjennomforingId = gjennomforingId,
408
409
innsokBegrunnelse = " innsøkbegrunnelse" ,
409
410
endretAv = Ident (ident = " SIG123" ),
410
411
datoTil = AKTIVITETSPLAN_LANSERINGSDATO .plusMonths(1 ).toLocalDate(),
412
+ endretTidspunkt = AKTIVITETSPLAN_LANSERINGSDATO .minusDays(1 ),
411
413
registrertDato = AKTIVITETSPLAN_LANSERINGSDATO .minusDays(1 )
412
414
)
413
415
val deltakerCommand = NyDeltakerCommand (deltakerInput)
@@ -420,7 +422,7 @@ class DeltakerIntegrationTests : IntegrationTestBase() {
420
422
}
421
423
422
424
@Test
423
- fun `dont ignore deltaker before aktivitetsplan launch if tildato after aktivitetsplan launch and oppfolgingsperiode was active` () {
425
+ fun `dont ignore deltaker moddato before aktivitetsplan launch if tildato after aktivitetsplan launch and oppfolgingsperiode was active` () {
424
426
val (gjennomforingId, deltakerId) = setup()
425
427
426
428
val foerstePeriode = Oppfolgingsperiode (
@@ -454,6 +456,42 @@ class DeltakerIntegrationTests : IntegrationTestBase() {
454
456
}
455
457
}
456
458
459
+ @Test
460
+ fun `find correct periode for deltakelse before aktivitetsplan launch when moddato is very recent` () {
461
+ val (gjennomforingId, deltakerId) = setup()
462
+
463
+ val foerstePeriode = Oppfolgingsperiode (
464
+ uuid = UUID .randomUUID(),
465
+ startDato = ZonedDateTime .of(AKTIVITETSPLAN_LANSERINGSDATO .minusDays(1 ), ZoneId .systemDefault()),
466
+ sluttDato = null
467
+ )
468
+
469
+ val deltakerInput = DeltakerInput (
470
+ personId = 345L ,
471
+ tiltakDeltakelseId = deltakerId,
472
+ tiltakgjennomforingId = gjennomforingId,
473
+ innsokBegrunnelse = " innsøkbegrunnelse" ,
474
+ endretAv = Ident (ident = " SIG123" ),
475
+ registrertDato = AKTIVITETSPLAN_LANSERINGSDATO .minusYears(1 ),
476
+ endretTidspunkt = LocalDateTime .now(),
477
+ datoTil = LocalDate .now().plusYears(25 )
478
+ )
479
+
480
+ val fnr = " 12345678901"
481
+ OrdsClientMock .fnrHandlers[deltakerInput.personId!! ] = { fnr }
482
+ OppfolgingClientMock .oppfolgingsperioder[fnr] = listOf (foerstePeriode)
483
+
484
+
485
+
486
+ val deltakerCommand = NyDeltakerCommand (deltakerInput)
487
+ val result = deltakerExecutor.execute(deltakerCommand)
488
+
489
+ result.expectHandled {
490
+ data -> data.headers.oppfolgingsperiode shouldBe foerstePeriode.uuid
491
+ }
492
+ }
493
+
494
+
457
495
@Test
458
496
fun `tittel should be set to default value when gjennomforing navn is null` () {
459
497
val gjennomforingId: Long = Random .nextLong()
0 commit comments