A UnitTest to ensure that the order of alleles is maintained

-> A, C, T and A, T, C are different and must be maintained.  The constructors were doing this appropriately, so nothing needed to be changed
This commit is contained in:
Mark DePristo 2011-10-08 08:47:58 -07:00
parent ff3dccd062
commit e94e6ba101
1 changed files with 13 additions and 1 deletions

View File

@ -11,12 +11,13 @@ import org.testng.annotations.BeforeSuite;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class VariantContextUnitTest extends BaseTest {
Allele A, Aref, T, Tref;
Allele A, Aref, C, T, Tref;
Allele del, delRef, ATC, ATCref;
// A [ref] / T at 10
@ -45,6 +46,7 @@ public class VariantContextUnitTest extends BaseTest {
delRef = Allele.create("-", true);
A = Allele.create("A");
C = Allele.create("C");
Aref = Allele.create("A", true);
T = Allele.create("T");
Tref = Allele.create("T", true);
@ -132,6 +134,16 @@ public class VariantContextUnitTest extends BaseTest {
Assert.assertEquals(vc.getType(), VariantContext.Type.SYMBOLIC);
}
@Test
public void testMultipleSNPAlleleOrdering() {
final List<Allele> allelesNaturalOrder = Arrays.asList(Aref, C, T);
final List<Allele> allelesUnnaturalOrder = Arrays.asList(Aref, T, C);
VariantContext naturalVC = new VariantContext("natural", snpLoc, snpLocStart, snpLocStop, allelesNaturalOrder);
VariantContext unnaturalVC = new VariantContext("unnatural", snpLoc, snpLocStart, snpLocStop, allelesUnnaturalOrder);
Assert.assertEquals(new ArrayList<Allele>(naturalVC.getAlleles()), allelesNaturalOrder);
Assert.assertEquals(new ArrayList<Allele>(unnaturalVC.getAlleles()), allelesUnnaturalOrder);
}
@Test
public void testCreatingSNPVariantContext() {