-
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.
[Act-Rep] Afficher l'identifiant navire pour tous les pavillons (#2930)
## Linked issues - Resolve #2928 ---- - [ ] Tests E2E (Cypress)
- Loading branch information
Showing
2 changed files
with
122 additions
and
1 deletion.
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
71 changes: 71 additions & 0 deletions
71
backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/domain/entities/vessel/VesselUTests.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,71 @@ | ||
package fr.gouv.cnsp.monitorfish.domain.entities.vessel | ||
|
||
import com.neovisionaries.i18n.CountryCode | ||
import org.assertj.core.api.Assertions.assertThat | ||
import org.junit.jupiter.api.Assertions.* | ||
import org.junit.jupiter.api.Test | ||
import org.junit.jupiter.api.extension.ExtendWith | ||
import org.springframework.test.context.junit.jupiter.SpringExtension | ||
|
||
@ExtendWith(SpringExtension::class) | ||
class VesselUTests { | ||
@Test | ||
fun `getNationalIdentifier should return the identifier for a FR vessel`() { | ||
// Given | ||
val vessel = Vessel( | ||
id = 1, | ||
internalReferenceNumber = "FRA00022680", | ||
vesselName = "MY AWESOME VESSEL", | ||
flagState = CountryCode.FR, | ||
declaredFishingGears = listOf("Trémails"), | ||
vesselType = "Fishing", | ||
districtCode = "AY", | ||
) | ||
|
||
// When | ||
val nationalIdentifier = vessel.getNationalIdentifier() | ||
|
||
// Then | ||
assertThat(nationalIdentifier).isEqualTo("AY22680") | ||
} | ||
|
||
@Test | ||
fun `getNationalIdentifier should return the identifier for a FR vessel When district code is null`() { | ||
// Given | ||
val vessel = Vessel( | ||
id = 1, | ||
internalReferenceNumber = "FRA00022680", | ||
vesselName = "MY AWESOME VESSEL", | ||
flagState = CountryCode.FR, | ||
declaredFishingGears = listOf("Trémails"), | ||
vesselType = "Fishing", | ||
districtCode = "", | ||
) | ||
|
||
// When | ||
val nationalIdentifier = vessel.getNationalIdentifier() | ||
|
||
// Then | ||
assertThat(nationalIdentifier).isEqualTo("22680") | ||
} | ||
|
||
@Test | ||
fun `getNationalIdentifier should return the identifier for a GB vessel`() { | ||
// Given | ||
val vessel = Vessel( | ||
id = 1, | ||
internalReferenceNumber = "GBR00022680", | ||
vesselName = "MY AWESOME VESSEL", | ||
flagState = CountryCode.GB, | ||
declaredFishingGears = listOf("Trémails"), | ||
vesselType = "Fishing", | ||
districtCode = "AY", | ||
) | ||
|
||
// When | ||
val nationalIdentifier = vessel.getNationalIdentifier() | ||
|
||
// Then | ||
assertThat(nationalIdentifier).isEqualTo("AY22680") | ||
} | ||
} |