final MostDistantStrategyAlignmentSpec[] firstEndSpecs,
final MostDistantStrategyAlignmentSpec[] secondEndSpecs) throws Exception {
final File unmappedSam = File.createTempFile("unmapped.", ".sam");
unmappedSam.deleteOnExit();
final SAMFileWriterFactory factory = new SAMFileWriterFactory();
final SAMFileHeader header = new SAMFileHeader();
header.setSortOrder(SAMFileHeader.SortOrder.queryname);
final String readName = "theRead";
final SAMRecord firstUnmappedRead = new SAMRecord(header);
firstUnmappedRead.setReadName(readName);
firstUnmappedRead.setReadString("ACGT");
firstUnmappedRead.setBaseQualityString("5555");
firstUnmappedRead.setReadUnmappedFlag(true);
firstUnmappedRead.setMateUnmappedFlag(true);
firstUnmappedRead.setReadPairedFlag(true);
firstUnmappedRead.setFirstOfPairFlag(true);
final SAMRecord secondUnmappedRead = new SAMRecord(header);
secondUnmappedRead.setReadName(readName);
secondUnmappedRead.setReadString("TCGA");
secondUnmappedRead.setBaseQualityString("6666");
secondUnmappedRead.setReadUnmappedFlag(true);
secondUnmappedRead.setMateUnmappedFlag(true);
secondUnmappedRead.setReadPairedFlag(true);
secondUnmappedRead.setSecondOfPairFlag(true);
final SAMFileWriter unmappedWriter = factory.makeSAMWriter(header, false, unmappedSam);
unmappedWriter.addAlignment(firstUnmappedRead);
unmappedWriter.addAlignment(secondUnmappedRead);
unmappedWriter.close();
final File alignedSam = File.createTempFile("aligned.", ".sam");
alignedSam.deleteOnExit();
final SAMFileReader dictReader = new SAMFileReader(sequenceDict);
header.setSequenceDictionary(dictReader.getFileHeader().getSequenceDictionary());
dictReader.close();
final SAMFileWriter alignedWriter = factory.makeSAMWriter(header, false, alignedSam);
String expectedFirstPrimarySequence = null;
int expectedFirstPrimaryAlignmentStart = -1;
String expectedSecondPrimarySequence = null;
int expectedSecondPrimaryAlignmentStart = -1;