Junjie
2026-04-27 e4e91b46d0ce781e7dc87dcdf0d2909b01911d4b
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
package com.zy.ai.service.impl;
 
import com.zy.asrs.entity.BasStation;
import org.junit.jupiter.api.Test;
 
import java.util.Arrays;
import java.util.Map;
 
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
 
class AutoTuneSnapshotServiceImplTest {
 
    @Test
    void buildStationOutTaskLimitMapPreservesNullZeroAndNegativeLimits() {
        AutoTuneSnapshotServiceImpl service = new AutoTuneSnapshotServiceImpl();
 
        Map<String, Integer> result = service.buildStationOutTaskLimitMap(Arrays.asList(
                station(101, null),
                station(102, 0),
                station(103, -1),
                station(104, 5)
        ));
 
        assertNull(result.get("101"));
        assertEquals(0, result.get("102"));
        assertEquals(-1, result.get("103"));
        assertEquals(5, result.get("104"));
    }
 
    private BasStation station(Integer stationId, Integer outTaskLimit) {
        BasStation station = new BasStation();
        station.setStationId(stationId);
        station.setOutTaskLimit(outTaskLimit);
        return station;
    }
}