ChromosomeParser { public static byte parseChr(String field) { if (field.startsWith("chr")) { return chr(field.substring(3)); } return chr(field); } private  ChromosomeParser(); static byte parseChr(String field);  }
@Test public void parseNumeric() throws Exception { assertThat(ChromosomeParser.parseChr("1"), equalTo((byte) 1)); assertThat(ChromosomeParser.parseChr("22"), equalTo((byte) 22)); }
@Test public void parseNumericWithChrPrefix() throws Exception { assertThat(ChromosomeParser.parseChr("chr1"), equalTo((byte) 1)); assertThat(ChromosomeParser.parseChr("chr22"), equalTo((byte) 22)); }
@Test public void parseX() throws Exception { assertThat(ChromosomeParser.parseChr("X"), equalTo((byte) 23)); assertThat(ChromosomeParser.parseChr("x"), equalTo((byte) 23)); assertThat(ChromosomeParser.parseChr("chrX"), equalTo((byte) 23)); }
@Test public void parseY() throws Exception { assertThat(ChromosomeParser.parseChr("Y"), equalTo((byte) 24)); assertThat(ChromosomeParser.parseChr("y"), equalTo((byte) 24)); assertThat(ChromosomeParser.parseChr("chrY"), equalTo((byte) 24)); }
@Test public void parseM() throws Exception { assertThat(ChromosomeParser.parseChr("M"), equalTo((byte) 25)); assertThat(ChromosomeParser.parseChr("MT"), equalTo((byte) 25)); assertThat(ChromosomeParser.parseChr("m"), equalTo((byte) 25)); assertThat(ChromosomeParser.parseChr("chrM"), equalTo((byte) 25)); }
@Test public void parseEmpty() throws Exception { assertThat(ChromosomeParser.parseChr(""), equalTo((byte) 0)); }
@Test public void parseVcfEmpty() throws Exception { assertThat(ChromosomeParser.parseChr("."), equalTo((byte) 0)); }
@Test public void parseUnknownScaffold() throws Exception { assertThat(ChromosomeParser.parseChr("Unk_GL000008v2"), equalTo((byte) 0)); }
@Test public void parseAltScaffold() throws Exception { assertThat(ChromosomeParser.parseChr("4_GL000008v2_alt"), equalTo((byte) 0)); }
@Test public void parseRandomScaffold() throws Exception { assertThat(ChromosomeParser.parseChr("4_GL000008v2_random"), equalTo((byte) 0)); }