修复Rooming List生成并导入0718需求包
This commit is contained in:
@@ -91,6 +91,7 @@ class ReservationRoomingListGenerationControllerTest {
|
||||
.param("arrival", "2026-07-26")
|
||||
.param("departure", "2026-07-29")
|
||||
.param("room_type", "UG1")
|
||||
.param("title", "MR")
|
||||
.param("rate_code", "RACK")
|
||||
.param("payment_type", "CA")
|
||||
.param("nationality", "CN"))
|
||||
@@ -101,6 +102,8 @@ class ReservationRoomingListGenerationControllerTest {
|
||||
.andExpect(header().string("Content-Disposition", containsString("rooming-list-HOTEL-TEST-")))
|
||||
.andExpect(result -> assertThat(result.getResponse().getContentAsByteArray())
|
||||
.startsWith(new byte[]{0x50, 0x4B}))
|
||||
.andExpect(result -> assertThat(titleCell(result.getResponse().getContentAsByteArray()))
|
||||
.isEqualTo("MR"))
|
||||
.andExpect(content().string(not(containsString("P123456"))));
|
||||
}
|
||||
|
||||
@@ -117,6 +120,18 @@ class ReservationRoomingListGenerationControllerTest {
|
||||
.andExpect(jsonPath("$.error_code").value("AUTH_TOKEN_REQUIRED"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldRejectRoomingListGenerationWhenTokenMissingBeforeBindingErrors() throws Exception {
|
||||
mockMvc.perform(multipart(ENDPOINT)
|
||||
.file(sourceFile())
|
||||
.param("hotel_id", "HOTEL-TEST")
|
||||
.param("people_per_room", "2")
|
||||
.param("arrival", "2026-07-26")
|
||||
.param("departure", "2026-07-29"))
|
||||
.andExpect(status().isUnauthorized())
|
||||
.andExpect(jsonPath("$.error_code").value("AUTH_TOKEN_REQUIRED"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldRejectRoomingListGenerationWhenPermissionMissing() throws Exception {
|
||||
String token = loginToken(mockMvc, "rooming-no-permission", "NoPerm@123456");
|
||||
@@ -199,4 +214,10 @@ class ReservationRoomingListGenerationControllerTest {
|
||||
outputStream.toByteArray());
|
||||
}
|
||||
}
|
||||
|
||||
private String titleCell(byte[] workbookBytes) throws Exception {
|
||||
try (XSSFWorkbook workbook = new XSSFWorkbook(new java.io.ByteArrayInputStream(workbookBytes))) {
|
||||
return workbook.getSheetAt(0).getRow(1).getCell(3).getStringCellValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@ class ReservationRoomingListGenerationServiceImplTest {
|
||||
assertThat(cellText(firstRoom.getCell(0))).isEqualTo("1");
|
||||
assertThat(cellText(firstRoom.getCell(1))).isEqualTo("LI");
|
||||
assertThat(cellText(firstRoom.getCell(2))).isEqualTo("CHUNHONG");
|
||||
assertThat(cellText(firstRoom.getCell(3))).isEqualTo("MR");
|
||||
assertThat(cellText(firstRoom.getCell(5))).isEqualTo("2026-07-29");
|
||||
assertThat(cellText(firstRoom.getCell(6))).isEqualTo("UG1");
|
||||
assertThat(cellText(firstRoom.getCell(8))).isEqualTo("1");
|
||||
@@ -121,6 +122,7 @@ class ReservationRoomingListGenerationServiceImplTest {
|
||||
LocalDate.of(2026, 7, 26),
|
||||
LocalDate.of(2026, 7, 29),
|
||||
"UG1",
|
||||
"MR",
|
||||
"RACK",
|
||||
null,
|
||||
0,
|
||||
|
||||
Reference in New Issue
Block a user