Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Positions] Ne pas renvoyer une erreur quand il n'y a pas de message JPE valide pour une marée #2406

Merged
merged 1 commit into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ class JpaLogbookReportRepository(
}

throw IllegalArgumentException("No CFR given to find the vessel.")
} catch (e: EmptyResultDataAccessException) {
throw NoLogbookFishingTripFound(getTripNotFoundExceptionMessage(internalReferenceNumber), e)
} catch (e: NoSuchElementException) {
throw NoLogbookFishingTripFound(getTripNotFoundExceptionMessage(internalReferenceNumber), e)
} catch (e: IllegalArgumentException) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ VALUES ('OOF20190126059903', '<ers:OPS AD="FRA" FR="OOE" ON="OOF20190126059903"
('OOF20190227059999', ''),
('OOF22103048321398', ''),
('OOF20191205059902', ''),
('OOF20190265896325', ''),
('OOF20190227050000', ''),
('OOF20190227050001', ''),
('OOF20190227050002', ''),
Expand Down Expand Up @@ -266,7 +267,12 @@ INSERT INTO logbook_reports (operation_number, trip_number, operation_country, o
referenced_report_id, report_datetime_utc,
cfr, ircs, external_identification, vessel_name, flag_state, imo, log_type, value,
integration_datetime_utc, transmission_format, software)
VALUES ('OOF20190227050001', 9463711, 'OOF', '2018-02-17T01:05:00Z', 'DAT', 'OOF20180212345698', null,
VALUES ('OOF20190265896325', 9463701, 'OOF', '2018-02-17T01:05:00Z', 'DAT', 'OOF20180212345698', null,
'2018-02-17T01:05:00Z',
'UNKNOWN_VESS', 'GMRS', 'ABC658', 'Unknown vessel', 'FRA', null, 'DEP',
'{"gearOnboard": [{"gear": "GTR", "mesh": 100.0}], "departurePort": "AEJAZ", "anticipatedActivity": "FSH", "tripStartDate": "2018-02-17T00:00Z", "departureDatetimeUtc": "2018-02-17T01:05Z"}',
'2019-01-18T07:17:28.317559Z', 'ERS', 'TurboCatch (3.7-1)'),
('OOF20190227050001', 9463711, 'OOF', '2018-02-17T01:05:00Z', 'DAT', 'OOF20180212345698', null,
'2018-02-17T01:05:00Z',
'U_W0NTFINDME', 'QGDF', 'ABC123456', 'MALOTRU', 'FRA', null, 'DEP',
'{"gearOnboard": [{"gear": "GTR", "mesh": 100.0}], "departurePort": "AEJAZ", "anticipatedActivity": "FSH", "tripStartDate": "2018-02-17T00:00Z", "departureDatetimeUtc": "2018-02-17T01:05Z"}',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -485,4 +485,20 @@ class JpaLogbookReportRepositoryITests : AbstractDBTests() {
// Then
assertThat(lastTrip.toString()).isEqualTo("2020-05-06T18:39:33Z")
}

@Test
@Transactional
fun `findFirstAcknowledgedDateOfTripBeforeDateTime Should throw a custom exception When the findFirstAcknowledgedDateOfTrip request is empty`() {
// When
val throwable = catchThrowable {
jpaLogbookReportRepository.findFirstAcknowledgedDateOfTripBeforeDateTime(
"UNKNOWN_VESS",
ZonedDateTime.parse("2018-02-17T01:06:00Z"),
)
}

// Then
assertThat(throwable).isInstanceOf(NoLogbookFishingTripFound::class.java)
assertThat(throwable.message).contains("No trip found found for the vessel.")
}
}
Loading