-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into jpa-init-infraction-natinf
- Loading branch information
Showing
16 changed files
with
308 additions
and
70 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
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
89 changes: 89 additions & 0 deletions
89
...n/fr/gouv/gmampa/rapportnav/domain/use_cases/mission/crew/GetAgentsCrewByMissionIdTest.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,89 @@ | ||
package fr.gouv.gmampa.rapportnav.domain.use_cases.mission.crew | ||
|
||
import fr.gouv.dgampa.rapportnav.domain.repositories.mission.crew.IMissionCrewRepository | ||
import fr.gouv.dgampa.rapportnav.domain.use_cases.mission.crew.GetAgentsCrewByMissionId | ||
import fr.gouv.dgampa.rapportnav.infrastructure.database.model.mission.crew.AgentModel | ||
import fr.gouv.dgampa.rapportnav.infrastructure.database.model.mission.crew.AgentRoleModel | ||
import fr.gouv.dgampa.rapportnav.infrastructure.database.model.mission.crew.MissionCrewModel | ||
import junit.framework.TestCase.assertEquals | ||
import org.junit.jupiter.api.Test | ||
import org.mockito.Mockito.`when` | ||
import org.springframework.beans.factory.annotation.Autowired | ||
import org.springframework.boot.test.context.SpringBootTest | ||
import org.springframework.boot.test.mock.mockito.MockBean | ||
|
||
@SpringBootTest(classes = [GetAgentsCrewByMissionId::class]) | ||
class GetAgentsCrewByMissionIdTest { | ||
|
||
@Autowired | ||
private lateinit var getAgentsCrewByMissionId: GetAgentsCrewByMissionId | ||
|
||
@MockBean | ||
private lateinit var agentCrewRepository: IMissionCrewRepository | ||
|
||
|
||
@Test | ||
fun `execute should return sorted list of crew members by role priority`() { | ||
|
||
val missionId = 1 | ||
|
||
val johnDoe = AgentModel( | ||
firstName = "John", | ||
lastName = "Doe", | ||
id = 1 | ||
) | ||
|
||
val janeDoe = AgentModel( | ||
firstName = "Jane", | ||
lastName = "Doe", | ||
id = 2 | ||
) | ||
|
||
val alfredDeMusset = AgentModel( | ||
firstName = "Alfred", | ||
lastName = "de Musset", | ||
id = 3 | ||
) | ||
|
||
val guyDeMaupassant = AgentModel( | ||
firstName = "Guy", | ||
lastName = "de Maupassant", | ||
id = 4 | ||
) | ||
|
||
val chefMecano = AgentRoleModel( | ||
title = "Chef mécanicien", | ||
id = 1 | ||
) | ||
|
||
val secondCapitaine = AgentRoleModel( | ||
title = "Second capitaine", | ||
id = 2 | ||
) | ||
|
||
val cuisinier = AgentRoleModel( | ||
title = "Cuisinier", | ||
id = 3 | ||
) | ||
|
||
val commandant = AgentRoleModel( | ||
title = "Commandant", | ||
id = 4 | ||
) | ||
|
||
val crewMembers = listOf( | ||
MissionCrewModel(role = chefMecano, agent = janeDoe, missionId = missionId, id = 1), | ||
MissionCrewModel(role = secondCapitaine, agent = johnDoe, missionId = missionId, id = 2), | ||
MissionCrewModel(role = cuisinier, agent = alfredDeMusset, missionId = missionId, id = 3), | ||
MissionCrewModel(role = commandant, agent = guyDeMaupassant, missionId = missionId, id = 4), | ||
) | ||
|
||
`when`(agentCrewRepository.findByMissionId(missionId)).thenReturn(crewMembers) | ||
|
||
val sortedCrew = getAgentsCrewByMissionId.execute(missionId, commentDefaultsToString = false) | ||
|
||
// Assert | ||
val expectedRoles = listOf("Commandant", "Second capitaine", "Chef mécanicien", "Cuisinier") | ||
assertEquals(expectedRoles, sortedCrew.map { it.role.title }) | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,6 +1,6 @@ | ||
{ | ||
"name": "frontend", | ||
"version": "2.2.5", | ||
"version": "2.2.6", | ||
"private": true, | ||
"type": "module", | ||
"engines": { | ||
|
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.