package com.zy.core.utils.station.model; import com.zy.core.utils.StationOperateProcessUtils; import com.zy.core.utils.station.StationDispatchLoadSupport; import com.zy.core.utils.station.StationOutboundDecisionSupport; import com.zy.core.utils.station.StationRerouteProcessor; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; class StationModelTypePlacementTest { @Test void rerouteTypes_areNoLongerNestedInsideStationOperateProcessUtils() { assertFalse(hasDeclaredClass(StationOperateProcessUtils.class, "RerouteSceneType")); assertFalse(hasDeclaredClass(StationOperateProcessUtils.class, "RerouteDecision")); assertFalse(hasDeclaredClass(StationOperateProcessUtils.class, "RerouteContext")); assertFalse(hasDeclaredClass(StationOperateProcessUtils.class, "RerouteCommandPlan")); assertFalse(hasDeclaredClass(StationOperateProcessUtils.class, "RerouteExecutionResult")); } @Test void dispatchLoadTypes_areNoLongerNestedInsideStationDispatchLoadSupport() { assertFalse(hasDeclaredClass(StationDispatchLoadSupport.class, "DispatchLimitConfig")); assertFalse(hasDeclaredClass(StationDispatchLoadSupport.class, "LoadGuardState")); assertFalse(hasDeclaredClass(StationDispatchLoadSupport.class, "LoopHitResult")); } @Test void outboundDecisionTypes_areNoLongerNestedInsideStationOutboundDecisionSupport() { assertFalse(hasDeclaredClass(StationOutboundDecisionSupport.class, "OutOrderDispatchDecision")); assertFalse(hasDeclaredClass(StationOutboundDecisionSupport.class, "CircleTargetCandidate")); } @Test void rerouteProcessor_isLocatedUnderStationPackage() { assertEquals("com.zy.core.utils.station", StationRerouteProcessor.class.getPackageName()); } private static boolean hasDeclaredClass(Class ownerType, String simpleName) { for (Class declaredClass : ownerType.getDeclaredClasses()) { if (simpleName.equals(declaredClass.getSimpleName())) { return true; } } return false; } }