| | |
| | | |
| | | import org.junit.jupiter.api.Assertions; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springblade.system.pojo.entity.Dict; |
| | | import org.springblade.system.pojo.entity.DictBiz; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | |
| | | @Test |
| | | public void testIsAnnotation(){ |
| | | ProgramAnnotationService s = new ProgramAnnotationService(); |
| | | Dict fanucDict = new Dict(); |
| | | DictBiz fanucDict = new DictBiz(); |
| | | fanucDict.setCode("machine_annotation"); |
| | | fanucDict.setDictKey("FANUC"); |
| | | fanucDict.setRemark("(,)"); |
| | | |
| | | Dict xmz = new Dict(); |
| | | DictBiz xmz = new DictBiz(); |
| | | xmz.setCode("machine_annotation"); |
| | | xmz.setDictKey("XIMENZI"); |
| | | xmz.setRemark("*-,"); |
| | | |
| | | List<Dict> dictList = Arrays.asList(fanucDict, xmz); |
| | | List<DictBiz> dictList = Arrays.asList(fanucDict, xmz); |
| | | Assertions.assertTrue(s.isAnnotation("(abc)","FANUC", dictList)); |
| | | |
| | | Assertions.assertFalse(s.isAnnotation("*-","FANUC",dictList)); |
| | | |
| | | Assertions.assertTrue(s.isAnnotation("*-","XIMENZI", dictList)); |
| | | } |
| | | |
| | | @Test |
| | | public void testIsAnnotation2(){ |
| | | ProgramAnnotationService s = new ProgramAnnotationService(); |
| | | Dict fanucDict = new Dict(); |
| | | DictBiz fanucDict = new DictBiz(); |
| | | fanucDict.setCode("machine_annotation"); |
| | | fanucDict.setDictKey("FANUC"); |
| | | fanucDict.setRemark("(,)"); |
| | | |
| | | Dict xmz = new Dict(); |
| | | DictBiz xmz = new DictBiz(); |
| | | xmz.setCode("machine_annotation"); |
| | | xmz.setDictKey("XIMENZI"); |
| | | xmz.setRemark("*-,"); |
| | | List<Dict> dictList = Arrays.asList(fanucDict, xmz); |
| | | List<DictBiz> dictList = Arrays.asList(fanucDict, xmz); |
| | | |
| | | Assertions.assertEquals("(A)",s.generateAnnotation("A","FANUC",dictList)); |
| | | |
| | | |
| | | Assertions.assertEquals("*-A",s.generateAnnotation("A","XIMENZI",dictList)); |
| | | } |