RefContextConsumer implements Consumer<SAMRecord> { @VisibleForTesting static int mnvLength(int readIndex, int refIndex, byte[] readBases, byte[] refBases) { final Function<Integer, Boolean> isDifferent = i -> refIndex + i < refBases.length && readIndex + i < readBases.length && refBases[refIndex + i] != readBases[readIndex + i]; if (isDifferent.apply(2)) { return 3; } return isDifferent.apply((1)) ? 2 : 1; } RefContextConsumer(@NotNull final SageConfig config, @NotNull final GenomeRegion bounds, @NotNull final RefSequence refGenome,
            @NotNull final RefContextFactory candidates); @Override void accept(@NotNull final SAMRecord record);  }
@Test public void testMnvLength() { assertEquals(1, RefContextConsumer.mnvLength(0, 0, "A".getBytes(), "CC".getBytes())); assertEquals(1, RefContextConsumer.mnvLength(0, 0, "AA".getBytes(), "C".getBytes())); assertEquals(2, RefContextConsumer.mnvLength(0, 0, "AAA".getBytes(), "CC".getBytes())); assertEquals(2, RefContextConsumer.mnvLength(0, 0, "AA".getBytes(), "CCC".getBytes())); assertEquals(2, RefContextConsumer.mnvLength(0, 0, "AAC".getBytes(), "CCC".getBytes())); assertEquals(3, RefContextConsumer.mnvLength(0, 0, "AAA".getBytes(), "CCC".getBytes())); assertEquals(3, RefContextConsumer.mnvLength(0, 0, "ACA".getBytes(), "CCCC".getBytes())); assertEquals(3, RefContextConsumer.mnvLength(0, 0, "ACAC".getBytes(), "CCCC".getBytes())); assertEquals(3, RefContextConsumer.mnvLength(0, 0, "AAAA".getBytes(), "CCCC".getBytes())); assertEquals(3, RefContextConsumer.mnvLength(1, 0, "AAAA".getBytes(), "CCCC".getBytes())); assertEquals(2, RefContextConsumer.mnvLength(2, 0, "AAAA".getBytes(), "CCCC".getBytes())); assertEquals(1, RefContextConsumer.mnvLength(3, 0, "AAAA".getBytes(), "CCCC".getBytes())); }