@Test
 public void testEqualsQuality() {
   frag.getQuality().append("AAAA".getBytes(), 0, 4);
   assertFalse(frag.equals(frag2));
   frag2.getQuality().append("AAAA".getBytes(), 0, 4);
   assertTrue(frag.equals(frag2));
 }
 @Test
 public void testConvertQualitySangerToIllumina() {
   frag.setSequence(new Text("AGTAGTAGTAGTAGTAGTAGTAGTAGTAGT"));
   frag.setQuality(new Text("[[[[[[[[[[[[[[[[[[[[[[[[[[[[[["));
   SequencedFragment.convertQuality(
       frag.getQuality(),
       FormatConstants.BaseQualityEncoding.Sanger,
       FormatConstants.BaseQualityEncoding.Illumina);
   assertEquals("zzzzzzzzzzzzzzzzzzzzzzzzzzzzzz", frag.getQuality().toString());
 }
  @Test
  public void testVerifyQualitySangerOutOfRange() {
    frag.setSequence(new Text("AGTAGTAGTAGTAGTAGTAGTAGTAGTAGT"));
    frag.setQuality(
        new Text("#############################" + Character.toString((char) 127))); // over range
    assertEquals(
        29,
        SequencedFragment.verifyQuality(
            frag.getQuality(), FormatConstants.BaseQualityEncoding.Sanger));

    frag.setQuality(new Text("##### ########################")); // under range
    assertEquals(
        5,
        SequencedFragment.verifyQuality(
            frag.getQuality(), FormatConstants.BaseQualityEncoding.Sanger));
  }
 @Test(expected = FormatException.class)
 public void testConvertQualitySangerUnderRange() {
   frag.setSequence(new Text("AGTAGTAGTAGTAGTAGTAGTAGTAGTAGT"));
   frag.setQuality(new Text("### ##########################"));
   SequencedFragment.convertQuality(
       frag.getQuality(),
       FormatConstants.BaseQualityEncoding.Sanger,
       FormatConstants.BaseQualityEncoding.Illumina);
 }
 @Test(expected = IllegalArgumentException.class)
 public void testConvertQualityNoop() {
   frag.setSequence(new Text("AGTAGTAGTAGTAGTAGTAGTAGTAGTAGT"));
   frag.setQuality(new Text("[[[[[[[[[[[[[[[[[[[[[[[[[[[[[["));
   SequencedFragment.convertQuality(
       frag.getQuality(),
       FormatConstants.BaseQualityEncoding.Sanger,
       FormatConstants.BaseQualityEncoding.Sanger);
 }
 @Test
 public void testVerifyQualityIlluminaOutOfRange() {
   frag.setSequence(new Text("AGTAGTAGTAGTAGTAGTAGTAGTAGTAGT"));
   frag.setQuality(new Text("zzz=zzzzzzzzzzzzzzzzzzzzzzzzzz"));
   assertEquals(
       3,
       SequencedFragment.verifyQuality(
           frag.getQuality(), FormatConstants.BaseQualityEncoding.Illumina));
 }
 @Test
 public void testVerifyQualitySangerOk() {
   frag.setSequence(new Text("AGTAGTAGTAGTAGTAGTAGTAGTAGTAGT"));
   frag.setQuality(new Text("##############################"));
   assertEquals(
       -1,
       SequencedFragment.verifyQuality(
           frag.getQuality(), FormatConstants.BaseQualityEncoding.Sanger));
 }
  @Test
  public void testInitialState() {
    assertNotNull(frag.getSequence());
    assertNotNull(frag.getQuality());

    assertNull(frag.getInstrument());
    assertNull(frag.getRunNumber());
    assertNull(frag.getFlowcellId());
    assertNull(frag.getLane());
    assertNull(frag.getTile());
    assertNull(frag.getXpos());
    assertNull(frag.getYpos());
    assertNull(frag.getRead());
    assertNull(frag.getFilterPassed());
    assertNull(frag.getControlNumber());
    assertNull(frag.getIndexSequence());

    assertNotNull(frag.toString());
  }