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();
|
}
|
|
|
}
|
}
|