public void testBad() {
   Diagnostic.setLogStream();
   final SAMRecord rec = new SAMRecord(new SAMFileHeader());
   rec.setReadString("TATTAGGATTGAGACTGGTAAAATGGNCCACCAAG");
   rec.setBaseQualityString("/725361840-525251.68,0,.52!222254/2");
   final VariantParams params = VariantParams.builder().create();
   try {
     new AlignmentEnvironmentCG(
         new VariantAlignmentRecord(rec),
         params,
         MachineErrorParams.builder().machine(MachineType.COMPLETE_GENOMICS).create(),
         null);
     fail();
   } catch (final NoTalkbackSlimException e) {
     assertTrue(e.getMessage(), e.getMessage().startsWith("Invalid CG alignment."));
   }
 }
  public void test() {
    final SAMRecord rec = new SAMRecord(new SAMFileHeader());
    rec.setReadString("TATTAGGATTGAGACTGGTAAAATGGNCCACCAAG");
    rec.setBaseQualityString("/725361840-525251.68,0,.52!222254/2");
    rec.setReadPairedFlag(true);
    final VariantParams params = VariantParams.builder().create();
    final AbstractMachineErrorParams me =
        MachineErrorParams.builder().machine(MachineType.COMPLETE_GENOMICS).create();
    final AlignmentEnvironment se =
        new AlignmentEnvironmentCG(new VariantAlignmentRecord(rec), params, me, null);

    assertFalse(!se.isInverted());
    final String exp =
        ""
            + "AlignmentEnvironment read=GAACCACCNGGTAAAATGGTCAGAGTTAGGATTAT "
            + "quality=["
            + "0.0200, 0.0398, 0.0126, 0.0100, 0.0200, 0.0200, 0.0200, 0.0200, 1.0000, 0.0200, "
            + "0.0100, 0.0501, 0.0794, 0.0316, 0.0794, 0.0050, 0.0079, 0.0501, 0.0251, 0.0100, "
            + "0.0200, 0.0100, 0.0200, 0.0100, 0.0631, 0.0316, 0.0126, 0.0050, 0.0251, 0.0079, "
            + "0.0158, 0.0100, 0.0200, 0.0063, 0.0398"
            + "] start=-1";
    assertEquals(exp, se.toString());
  }
  public void testDefaultQuality() {
    final SAMRecord rec = new SAMRecord(new SAMFileHeader());
    rec.setReadString("TATTAGGATTGAGACTGGTAAAATGGNCCACCAAG");
    rec.setReadPairedFlag(true);
    final VariantParams params = VariantParams.builder().defaultQuality(10).create();
    final AlignmentEnvironment se =
        new AlignmentEnvironmentCG(
            new VariantAlignmentRecord(rec),
            params,
            MachineErrorParams.builder().machine(MachineType.COMPLETE_GENOMICS).create(),
            null);

    assertFalse(!se.isInverted());
    final String exp =
        ""
            + "AlignmentEnvironment read=GAACCACCNGGTAAAATGGTCAGAGTTAGGATTAT "
            + "quality=["
            + "0.1000, 0.1000, 0.1000, 0.1000, 0.1000, 0.1000, 0.1000, 0.1000, 0.1000, 0.1000, "
            + "0.1000, 0.1000, 0.1000, 0.1000, 0.1000, 0.1000, 0.1000, 0.1000, 0.1000, 0.1000, "
            + "0.1000, 0.1000, 0.1000, 0.1000, 0.1000, 0.1000, 0.1000, 0.1000, 0.1000, 0.1000, "
            + "0.1000, 0.1000, 0.1000, 0.1000, 0.1000"
            + "] start=-1";
    assertEquals(exp, se.toString());
  }