yangys
2024-02-05 182dd03086a2dbff1058b92bcf9864398bef2ae8
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package com.qianwen.mdc.service.plant;
 
 
import static org.assertj.core.api.Assertions.assertThat;
 
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
 
import org.apache.commons.io.IOUtils;
import org.junit.jupiter.api.Test;
 
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
 
public class PlantServiceTest {
 
    @Test
    public void t() {
        InputStream ins = this.getClass().getClassLoader().getResourceAsStream("plant.json");
        
        String str;
        try {
            str = IOUtils.toString(ins,"UTF8");
            
            PlantService s = new PlantService();
            List<Long> list = s.parseMachineIdInGrid(str);
            
            assertThat(list.size(), is(equalTo(2)));
            
            System.out.println(list.size());
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
                
                
    }
    
    @Test
    public void t2() {
        InputStream ins = this.getClass().getClassLoader().getResourceAsStream("plant2.json");
        
        String str;
        try {
            str = IOUtils.toString(ins,"UTF8");
            
            PlantService s = new PlantService();
            List<Long> list = s.parseMachineIdInGrid(str);
            //Integer m2Id = 2240138065925;
            assertThat(list.size(), is(equalTo(2)));
            
            System.out.println(list.size());
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
                
                
    }
}