ReaderTGFF { protected void importLink(Iterator<String> it, LinkTypes<Link> linkTypes) { Link link = new Link(WIRE); String currentLine; String property = ""; while (!isClosing(currentLine = it.next())) { if (isComment(currentLine)) { property = currentLine.replace(COMMENT, "").trim(); } else if (!currentLine.contains("{") && !currentLine.contains("}")) { link.setAttribute(property, Double.valueOf(currentLine)); } } linkTypes.put(WIRE, link); }  SpecificationTypeBased read(String filename); SpecificationTypeBased read(File file); SpecificationTypeBased read(InputStream in); SpecificationTypeBased toSpecification(List<String> in); static final String TGFF_TYPE; static final String PERIOD; static final String MSG_SIZE; static final String RES_ATTRIBUTES; static final String RES_VALUES; static final String HARD_DEADLINE; static final String SOFT_DEADLINE; static final String WIRE; }
@Test public void testImportLink() { List<String> in = Arrays.asList("# max_buffer_size", "491", "# a comment }", "}"); Iterator<String> it = in.iterator(); LinkTypes<Link> linkTypes = new LinkTypes<Link>(); new ReaderTGFF().importLink(it, linkTypes); Assert.assertEquals(1, linkTypes.size()); Assert.assertTrue(linkTypes.containsKey(ReaderTGFF.WIRE)); Assert.assertNotNull(linkTypes.get(ReaderTGFF.WIRE).getAttribute("max_buffer_size")); }