shinnosuke
2026-08-21 bc2efbdb52190fe2e7be9920bbed6902d4ee28aa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package com.talentcard.server.business.admin;
 
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatCode;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.mockito.Mockito.mock;
 
import com.talentcard.server.common.BusinessException;
import org.junit.jupiter.api.Test;
import org.springframework.jdbc.core.JdbcTemplate;
 
class AdminBusinessServiceTests {
 
    private final AdminBusinessService service = new AdminBusinessService(mock(JdbcTemplate.class));
 
    @Test
    void apartmentMerchantAllowsBlankAddress() {
        assertThatCode(() -> service.validateMerchantAddress("公寓租赁", ""))
                .doesNotThrowAnyException();
    }
 
    @Test
    void otherMerchantTypesStillRequireAddress() {
        assertThatThrownBy(() -> service.validateMerchantAddress("酒店服务", " "))
                .isInstanceOf(BusinessException.class)
                .hasMessageContaining("请输入商家地址");
    }
 
    @Test
    void supportsMerchantAppLoginForConfiguredServiceTypes() {
        assertThat(service.supportsMerchantAppLogin("数码服务")).isTrue();
        assertThat(service.supportsMerchantAppLogin("文化服务")).isTrue();
        assertThat(service.supportsMerchantAppLogin("电信服务")).isTrue();
        assertThat(service.supportsMerchantAppLogin("口腔治疗保健")).isTrue();
        assertThat(service.supportsMerchantAppLogin("家电服务")).isTrue();
        assertThat(service.supportsMerchantAppLogin("购房优惠")).isTrue();
        assertThat(service.supportsMerchantAppLogin("购车服务")).isTrue();
        assertThat(service.supportsMerchantAppLogin("加油服务")).isTrue();
    }
 
    @Test
    void supportsMerchantAppLoginForHotelMerchants() {
        assertThat(service.supportsMerchantAppLogin("酒店服务")).isTrue();
    }
}