@Test(dataProvider = "dataLines") public void testDecode1( String str, String contig, int start, int end, List<String> header, List<String> vals) { TableCodec tc = new TableCodec(); final TableFeature decode = tc.decode(str); Assert.assertEquals(decode.getContig(), contig, "contig"); Assert.assertEquals(decode.getStart(), start, "start"); Assert.assertEquals(decode.getEnd(), end, "end"); Assert.assertEquals(decode.getHeader(), header, decode.getHeader().toString()); Assert.assertEquals(decode.columnCount(), vals.size()); for (int i = 0; i < decode.columnCount(); i++) { Assert.assertEquals(decode.getValue(i), vals.get(i), "i:" + i); } }
@Test public void testDecodeHeader2() { TableCodec tc = new TableCodec(); final String str2 = "1:1 1 2 3"; LineReader reader = makeReader(asList("HEADER a b c", str2)); LineIterator li = new LineIteratorImpl(reader); List<String> hd = tc.readActualHeader(li); Assert.assertEquals(hd, asList("HEADER", "a", "b", "c")); final TableFeature decode = tc.decode(str2); Assert.assertEquals(decode.get("a"), "1"); Assert.assertEquals(decode.get("b"), "2"); Assert.assertEquals(decode.get("c"), "3"); Assert.assertEquals(decode.getLocation().getContig(), "1"); Assert.assertEquals(decode.getContig(), "1"); Assert.assertEquals(decode.getLocation().getStart(), 1); Assert.assertEquals(decode.getLocation().getEnd(), 1); }