fix: issues found in the invitations live check
- guest list failed when no guest was linked yet (Map.of().get(null)) - counter errors arrive as ProblemDetail: read the reason code from detail; drop the counter error advice the core handler always overrode - emails published with a null sender failed the NOT NULL column Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
This commit is contained in:
1 parent
aed9473aba
commit
fbbc5d0980
10 files changed
+115
-87
No files matched your search
+10
@@ -146,6 +146,16 @@ class AdminEventServiceCapacityTest {
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void update_capBelowGuests_fromTheCountersProblemDetailBody() {
|
||||
grantGuestsModuleToRole(3L);
|
||||
when(rest.postForEntity(eq(SAVE), any(ParameterizedTypeReference.class), any()))
|
||||
.thenThrow(HttpClientErrorException.create(HttpStatus.CONFLICT, "Conflict", null,
|
||||
"{\"type\":\"about:blank\",\"title\":\"Conflict\",\"status\":409,\"detail\":\"CAP_BELOW_GUESTS\"}".getBytes(), null));
|
||||
assertThatThrownBy(() -> service.update(String.valueOf(UUID), req(800, 1)))
|
||||
.isInstanceOfSatisfying(CodedResponseStatusException.class, e -> assertThat(e.getCode()).isEqualTo("CAP_BELOW_GUESTS"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void update_failedModuleLookup_failsClosedAndKeepsLimits() {
|
||||
when(rest.getForEntity(eq(MODULES), any(ParameterizedTypeReference.class), eq("BO"))).thenThrow(new IllegalStateException("down"));
|
||||
|
||||
+12
@@ -301,6 +301,18 @@ class PublicInviteServiceTest {
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void inviteRegister_eventFull_fromTheCountersProblemDetailBody() {
|
||||
// The counter's core handler renders ResponseStatusException as a ProblemDetail: the reason is in "detail".
|
||||
when(rest.postForEntity(eq(GUEST_REGISTER), any(ParameterizedTypeReference.class), any())).thenThrow(
|
||||
HttpClientErrorException.create(HttpStatus.CONFLICT, "c", null,
|
||||
"{\"type\":\"about:blank\",\"title\":\"Conflict\",\"status\":409,\"detail\":\"EVENT_FULL\"}".getBytes(), null));
|
||||
assertThatThrownBy(() -> service.inviteRegister(GT, ok())).isInstanceOfSatisfying(CodedResponseStatusException.class, e -> {
|
||||
assertThat(e.getReason()).isEqualTo("This event is full");
|
||||
assertThat(e.getBody().getProperties()).containsEntry("code", "EVENT_FULL");
|
||||
});
|
||||
}
|
||||
|
||||
// --- invite check-in ---
|
||||
|
||||
@Test
|
||||
|
||||
Reference in new issue
Block a user