40 lines
1.7 KiB
Java
40 lines
1.7 KiB
Java
|
|
package com.label.unit;
|
||
|
|
|
||
|
|
import org.junit.jupiter.api.DisplayName;
|
||
|
|
import org.junit.jupiter.api.Test;
|
||
|
|
|
||
|
|
import static org.assertj.core.api.Assertions.assertThatCode;
|
||
|
|
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||
|
|
|
||
|
|
@DisplayName("标准目录扁平化迁移守卫测试")
|
||
|
|
class PackageStructureMigrationTest {
|
||
|
|
|
||
|
|
@Test
|
||
|
|
@DisplayName("基础设施类已迁移到目标目录")
|
||
|
|
void infrastructureTypesMoved() {
|
||
|
|
assertClassExists("com.label.annotation.OperationLog");
|
||
|
|
assertClassExists("com.label.aspect.AuditAspect");
|
||
|
|
assertClassExists("com.label.config.MybatisPlusConfig");
|
||
|
|
assertClassExists("com.label.config.OpenApiConfig");
|
||
|
|
assertClassExists("com.label.config.RedisConfig");
|
||
|
|
assertClassExists("com.label.event.ExtractionApprovedEvent");
|
||
|
|
assertClassExists("com.label.listener.ExtractionApprovedEventListener");
|
||
|
|
|
||
|
|
assertClassMissing("com.label.common.aop.OperationLog");
|
||
|
|
assertClassMissing("com.label.common.aop.AuditAspect");
|
||
|
|
assertClassMissing("com.label.common.config.MybatisPlusConfig");
|
||
|
|
assertClassMissing("com.label.common.config.OpenApiConfig");
|
||
|
|
assertClassMissing("com.label.common.config.RedisConfig");
|
||
|
|
assertClassMissing("com.label.module.annotation.event.ExtractionApprovedEvent");
|
||
|
|
assertClassMissing("com.label.module.annotation.service.ExtractionApprovedEventListener");
|
||
|
|
}
|
||
|
|
|
||
|
|
private static void assertClassExists(String fqcn) {
|
||
|
|
assertThatCode(() -> Class.forName(fqcn)).doesNotThrowAnyException();
|
||
|
|
}
|
||
|
|
|
||
|
|
private static void assertClassMissing(String fqcn) {
|
||
|
|
assertThatThrownBy(() -> Class.forName(fqcn)).isInstanceOf(ClassNotFoundException.class);
|
||
|
|
}
|
||
|
|
}
|