Windows-Zeichenbereinigung im Basis-Dateinamen wirksam gemacht und Tests
korrigiert
This commit is contained in:
@@ -202,16 +202,35 @@ class TargetFilenameBuildingServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void buildBaseFilename_titleWithSlash_returnsInconsistentProposalState() {
|
||||
void buildBaseFilename_titleWithSlash_removesWindowsIncompatibleCharacterAndSucceeds() {
|
||||
// Slash (/) is a Windows-incompatible character. It should be removed,
|
||||
// leaving "RgStrom" which is valid (letters only)
|
||||
ProcessingAttempt attempt = proposalAttempt(LocalDate.of(2026, 1, 1), "Rg/Strom");
|
||||
|
||||
BaseFilenameResult result = TargetFilenameBuildingService.buildBaseFilename(attempt);
|
||||
|
||||
assertThat(result).isInstanceOf(InconsistentProposalState.class);
|
||||
assertThat(result).isInstanceOf(BaseFilenameReady.class);
|
||||
assertThat(((BaseFilenameReady) result).baseFilename())
|
||||
.isEqualTo("2026-01-01 - RgStrom.pdf");
|
||||
}
|
||||
|
||||
@Test
|
||||
void buildBaseFilename_titleWithMultipleWindowsChars_removesAllAndSucceeds() {
|
||||
// Multiple Windows-incompatible characters (: and ") should be removed,
|
||||
// leaving "Rechnung 2026" which is valid (letters, digits, and spaces)
|
||||
ProcessingAttempt attempt = proposalAttempt(LocalDate.of(2026, 1, 1), "Rechnung: \"2026\"");
|
||||
|
||||
BaseFilenameResult result = TargetFilenameBuildingService.buildBaseFilename(attempt);
|
||||
|
||||
assertThat(result).isInstanceOf(BaseFilenameReady.class);
|
||||
assertThat(((BaseFilenameReady) result).baseFilename())
|
||||
.isEqualTo("2026-01-01 - Rechnung 2026.pdf");
|
||||
}
|
||||
|
||||
@Test
|
||||
void buildBaseFilename_titleWithDot_returnsInconsistentProposalState() {
|
||||
// Dot (.) is NOT a Windows-incompatible character (as per our list < > : " / \ | ? *)
|
||||
// So it remains in the cleaned title and causes validation to fail
|
||||
ProcessingAttempt attempt = proposalAttempt(LocalDate.of(2026, 1, 1), "Rechnung.pdf");
|
||||
|
||||
BaseFilenameResult result = TargetFilenameBuildingService.buildBaseFilename(attempt);
|
||||
|
||||
Reference in New Issue
Block a user