刘光辉
13 小时以前 34981c30a78e8bbd7791131059a9210f9928b62c
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
38
39
40
41
42
43
44
45
package jnpf.limsService.support;
 
import java.math.BigDecimal;
import java.util.Arrays;
 
public class LimsWendingxingFenxiSupportChecks {
 
    public static void main(String[] args) {
        assertEquals(new BigDecimal("6.70"), LimsWendingxingFenxiSupport.strictDecimal(" 6.70 "),
                "纯数值必须保留精度");
        assertEquals(null, LimsWendingxingFenxiSupport.strictDecimal("<0.01"),
                "带限定符的结果不能进入折线图");
        assertEquals(null, LimsWendingxingFenxiSupport.strictDecimal("未检出"),
                "文字结果不能进入折线图");
        assertEquals(Arrays.asList("a", "b"),
                LimsWendingxingFenxiSupport.normalizeIds(Arrays.asList(" a ", "b", "a", "")),
                "ID 必须去空格、去空值并保持首次出现顺序");
        assertTrue(LimsWendingxingFenxiSupport.periodOrder(new BigDecimal("7"), "天")
                        < LimsWendingxingFenxiSupport.periodOrder(new BigDecimal("1"), "月"),
                "混合周期单位必须按归一化时长排序");
        assertEquals("oos", LimsWendingxingFenxiSupport.exceptionType(
                "oos", "compliant", new BigDecimal("6"), new BigDecimal("5"), new BigDecimal("7")),
                "OOS 调查类型优先");
        assertEquals("non_compliant", LimsWendingxingFenxiSupport.exceptionType(
                "na", "non_compliant", new BigDecimal("6"), null, null),
                "不符合规定结论必须展示");
        assertEquals("out_of_limit", LimsWendingxingFenxiSupport.exceptionType(
                "na", "compliant", new BigDecimal("8"), new BigDecimal("5"), new BigDecimal("7")),
                "未归类的超限结果必须标为待确认");
        assertEquals("ad", LimsWendingxingFenxiSupport.exceptionType(
                "ad", "compliant", null, null, null), "AD 调查类型必须展示");
    }
 
    private static void assertEquals(Object expected, Object actual, String message) {
        if (expected == null ? actual != null : !expected.equals(actual)) {
            throw new AssertionError(message + ": expected=" + expected + ", actual=" + actual);
        }
    }
 
    private static void assertTrue(boolean actual, String message) {
        if (!actual) {
            throw new AssertionError(message);
        }
    }
}