|
|
@@ -112,7 +112,22 @@ class BusinessCockpitMonitoringDistributionAdapterTest {
|
|
|
.findFirst().orElseThrow().getIndustry());
|
|
|
}
|
|
|
|
|
|
- // ---- stubbing helpers ----
|
|
|
+ @Test
|
|
|
+ void nestedEquipmentTypeResolvesIndustryFromRoot() {
|
|
|
+ stubPoints(Collections.emptyList());
|
|
|
+ stubTypes(Arrays.asList(
|
|
|
+ type(4, "4", "窨井设备", "0"),
|
|
|
+ type(40, "40", "窨井监测族", "4"),
|
|
|
+ type(41, "41", "窨井传感器", "40")));
|
|
|
+ stubDevices(Collections.emptyList(), Collections.emptyList());
|
|
|
+
|
|
|
+ CockpitMonitoringDistributionSnapshot snapshot = adapter.load(null);
|
|
|
+
|
|
|
+ assertEquals("MANHOLE", snapshot.getTypes().stream()
|
|
|
+ .filter(item -> "41".equals(item.getCode()))
|
|
|
+ .findFirst().orElseThrow(AssertionError::new).getIndustry());
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
private void stubPoints(List<MonitorPoint> points) {
|
|
|
when(monitorPointService.list()).thenReturn(points);
|