Skip to content

Commit

Permalink
Add GetPrioNotificationTypes use case unit test in Backend
Browse files Browse the repository at this point in the history
  • Loading branch information
ivangabriele committed Mar 25, 2024
1 parent 9e35543 commit 17dbe5f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import org.springframework.boot.test.mock.mockito.MockBean
import org.springframework.test.context.junit.jupiter.SpringExtension

@ExtendWith(SpringExtension::class)
class GetPrioNotificationsUTests {
class GetPriorNotificationTypesUTests {
@MockBean
private lateinit var facadeAreasRepository: FacadeAreasRepository

Expand All @@ -25,7 +25,7 @@ class GetPrioNotificationsUTests {
private lateinit var reportingRepository: ReportingRepository

@Test
fun `execute Should return a list prior notifications`() {
fun `execute Should return a list of prior notification types`() {
// Given
given(logbookReportRepository.findAllPriorNotifications(LogbookReportFilter())).willReturn(
listOf(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package fr.gouv.cnsp.monitorfish.domain.use_cases.prior_notification

import com.nhaarman.mockitokotlin2.given
import fr.gouv.cnsp.monitorfish.domain.repositories.*
import org.assertj.core.api.Assertions
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.ExtendWith
import org.springframework.boot.test.mock.mockito.MockBean
import org.springframework.test.context.junit.jupiter.SpringExtension

@ExtendWith(SpringExtension::class)
class GetPriorNotificationsUTests {
@MockBean
private lateinit var logbookReportRepository: LogbookReportRepository

@Test
fun `execute Should return a list of prior notifications`() {
// Given
given(logbookReportRepository.findDistinctPriorNotificationTypes()).willReturn(
listOf("Préavis de Type A", "Préavis de Type B"),
)

// When
val result = GetPriorNotificationTypes(logbookReportRepository).execute()

// Then
Assertions.assertThat(result).isEqualTo(listOf("Préavis de Type A", "Préavis de Type B"))
}
}

0 comments on commit 17dbe5f

Please sign in to comment.