自动化立体仓库 - WMS系统
zwl
11 小时以前 f74bf0293984b8569f8cb3ab14975276ccffb7a4
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
package com.zy.asrs.utils;
 
import org.junit.jupiter.api.Test;
 
import java.lang.reflect.Method;
 
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
 
class UtilsLocTypeNormalizationTest {
 
    @Test
    void normalizeLocType1_shouldKeepLowLocType() throws Exception {
        assertEquals(Short.valueOf((short) 1), invokeNormalizeLocType1(1));
    }
 
    @Test
    void normalizeLocType1_shouldKeepHighLocType() throws Exception {
        assertEquals(Short.valueOf((short) 2), invokeNormalizeLocType1(2));
    }
 
    @Test
    void normalizeLocType1_shouldRejectUnsupportedValue() throws Exception {
        assertNull(invokeNormalizeLocType1(3));
        assertNull(invokeNormalizeLocType1(null));
    }
 
    private Short invokeNormalizeLocType1(Integer value) throws Exception {
        Method method = Utils.class.getDeclaredMethod("normalizeLocType1", Integer.class);
        method.setAccessible(true);
        return (Short) method.invoke(null, value);
    }
}