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();
|
}
|
|
@Test
|
void doesNotSupportMerchantAppLoginForUnconfiguredServiceTypes() {
|
assertThat(service.supportsMerchantAppLogin("酒店服务")).isFalse();
|
}
|
}
|