-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finalize scheduled archive reportings
- Loading branch information
1 parent
e09d07a
commit 5cdb5ff
Showing
10 changed files
with
102 additions
and
45 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
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
37 changes: 37 additions & 0 deletions
37
...in/fr/gouv/cnsp/monitorfish/domain/use_cases/reporting/ArchiveOutdatedReportingsUTests.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,37 @@ | ||
package fr.gouv.cnsp.monitorfish.domain.use_cases.reporting | ||
|
||
import com.nhaarman.mockitokotlin2.eq | ||
import com.nhaarman.mockitokotlin2.verify | ||
import fr.gouv.cnsp.monitorfish.domain.entities.alerts.type.MissingFARAlert | ||
import fr.gouv.cnsp.monitorfish.domain.entities.alerts.type.ThreeMilesTrawlingAlert | ||
import fr.gouv.cnsp.monitorfish.domain.entities.alerts.type.TwelveMilesFishingAlert | ||
import fr.gouv.cnsp.monitorfish.domain.repositories.ReportingRepository | ||
import org.junit.jupiter.api.Test | ||
import org.junit.jupiter.api.extension.ExtendWith | ||
import org.mockito.BDDMockito.given | ||
import org.springframework.boot.test.mock.mockito.MockBean | ||
import org.springframework.test.context.junit.jupiter.SpringExtension | ||
|
||
@ExtendWith(SpringExtension::class) | ||
class ArchiveOutdatedReportingsUTests { | ||
@MockBean | ||
private lateinit var reportingRepository: ReportingRepository | ||
|
||
@Test | ||
fun `execute Should archive outdated reportings`() { | ||
// Given | ||
given(reportingRepository.findUnarchivedReportings()).willReturn( | ||
listOf( | ||
Pair(1, TwelveMilesFishingAlert("NAMO")), | ||
Pair(2, ThreeMilesTrawlingAlert("NAMO")), | ||
Pair(3, MissingFARAlert("NAMO")), | ||
), | ||
) | ||
|
||
// When | ||
ArchiveOutdatedReportings(reportingRepository).execute() | ||
|
||
// Then | ||
verify(reportingRepository).archiveReportings(eq(listOf(2, 3))) | ||
} | ||
} |
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