From c5a63165aca6468157e0b4807d511e828de2076a Mon Sep 17 00:00:00 2001
From: shinnosuke <tantao@1hoper.com>
Date: 星期三, 16 九月 2026 16:07:33 +0800
Subject: [PATCH] 再次更新
---
talent-card-server/src/test/java/com/talentcard/server/business/portal/PortalServiceTests.java | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/talent-card-server/src/test/java/com/talentcard/server/business/portal/PortalServiceTests.java b/talent-card-server/src/test/java/com/talentcard/server/business/portal/PortalServiceTests.java
index 6812ae2..7fe6235 100644
--- a/talent-card-server/src/test/java/com/talentcard/server/business/portal/PortalServiceTests.java
+++ b/talent-card-server/src/test/java/com/talentcard/server/business/portal/PortalServiceTests.java
@@ -88,6 +88,13 @@
assertThat(foodTags).containsExactly("券", "8.5折");
assertThat(cinemaTags).isEmpty();
+ for (String type : List.of("employment", "finance", "approval", "apartment", "fuel",
+ "housing", "car", "appliance", "digital", "telecom")) {
+ List<String> tags = (List<String>) method.invoke(service,
+ Map.of("merchantType", type, "couponAvailable", true, "discountText", "7折"),
+ Map.of("serviceLabel", "人才专享"), null);
+ assertThat(tags).as(type).isEmpty();
+ }
List<String> scenicTags = (List<String>) method.invoke(service,
Map.of("merchantType", "scenic", "couponAvailable", true, "discountText", "8.8折"),
@@ -118,4 +125,23 @@
assertThat(foodTags).containsExactly("券", "8.8折");
assertThat(hotelTags).containsExactly("券", "免费2次", "8.5折");
}
+
+ @Test
+ @SuppressWarnings("unchecked")
+ void parkingTagsUseFreeForFreeRightsAndDiscountForPaidRights() throws Exception {
+ when(jdbc.queryForList(anyString(), any(Object[].class))).thenReturn(List.of());
+ when(jdbc.queryForObject(anyString(), eq(Long.class), any(Object[].class))).thenReturn(0L);
+ Method method = PortalService.class.getDeclaredMethod(
+ "parkingBenefitTags", Long.class, List.class, String.class, String.class);
+ method.setAccessible(true);
+
+ List<String> freeTags = (List<String>) method.invoke(service, 1L, List.of(Map.of(
+ "level", "卓越人才卡", "enabled", true, "parkingType", "free")), "卓越人才卡", "LOCAL");
+ List<String> paidTags = (List<String>) method.invoke(service, 1L, List.of(Map.of(
+ "level", "卓越人才卡", "enabled", true, "parkingType", "paid",
+ "storeConsume", true, "consumeEnabled", false, "discount", "8.50")), "卓越人才卡", "LOCAL");
+
+ assertThat(freeTags).containsExactly("免费");
+ assertThat(paidTags).containsExactly("8.5折");
+ }
}
--
Gitblit v1.7.1