Changing testing framework from junit -> testng, for its enhanced configurability.

Initial test to see how Bamboo will respond.  More detailed email to follow.


git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4609 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
hanna 2010-11-01 21:31:44 +00:00
parent fe3f78e1d3
commit 861ee3e37a
108 changed files with 876 additions and 795 deletions

View File

@ -21,10 +21,10 @@
<!-- where to find 'findbugs', which you must set if you plan to use 'ant findbugs' -->
<property name="findbugs.home" value="./findbugs"/>
<!-- do we want to halt on failure of a junit test? default to yes (Bamboo uses 'no') -->
<!-- do we want to halt on failure of a unit test? default to yes (Bamboo uses 'no') -->
<property name="halt" value="yes" />
<!-- should our junit test output go to a file or the screen?
<!-- should our unit test output go to a file or the screen?
false means it goes to the screen (default) true to file -->
<property name="usefile" value="false" />
@ -57,7 +57,7 @@
</path>
<patternset id="dependency.mask" includes="*.jar">
<exclude name="junit*.jar" />
<exclude name="testng*.jar" />
<exclude name="bcel*.jar" />
</patternset>
@ -413,7 +413,7 @@
<classpath>
<path refid="external.dependencies" />
<pathelement location="${java.classes}"/>
<pathelement location="lib/junit-4.4.jar"/>
<pathelement location="lib/testng-5.14.1.jar"/>
</classpath>
</javac>
@ -425,7 +425,7 @@
<path refid="queue.dependencies"/>
<pathelement location="${queue.classes}"/>
<pathelement location="${java.test.classes}"/>
<pathelement location="lib/junit-4.4.jar"/>
<pathelement location="lib/testng-5.14.1.jar"/>
</classpath>
</scalac>
</target>
@ -486,27 +486,33 @@
<sequential>
<mkdir dir="${report}"/>
<echo message="Sting: Running @{testtype} test cases!"/>
<junit printsummary="yes" showoutput="yes" maxmemory="${test.maxmemory}" clonevm="yes" haltonfailure="${halt}" failureProperty="test.failure">
<formatter type="brief" usefile="false" />
<formatter type="xml"/>
<taskdef resource="testngtasks" classpath="lib/testng-5.14.1.jar"/>
<testng outputDir="${report}"
haltOnFailure="true" verbose="2"
workingDir="${basedir}">
<!--
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"/>
-->
<classpath>
<path refid="build.results"/>
<pathelement location="${java.test.classes}"/>
<pathelement location="${queue.test.classes}"/>
<pathelement location="lib/junit-4.4.jar"/>
<path refid="external.dependencies" />
<pathelement location="${java.classes}" />
<pathelement location="${queue.classes}" />
<pathelement location="${java.test.classes}" />
<pathelement location="${queue.test.classes}" />
</classpath>
<batchtest fork="yes" todir="${report}">
<fileset dir="${java.test.classes}">
<include name="**/@{testtype}.class"/>
<exclude name="**/BaseTest.class"/>
</fileset>
<fileset dir="${queue.test.classes}">
<include name="**/@{testtype}.class"/>
<exclude name="**/BaseTest.class"/>
</fileset>
</batchtest>
</junit>
<classfileset dir="${java.test.classes}" includes="**/@{testtype}.class"/>
<classfileset dir="${queue.test.classes}" includes="**/@{testtype}*.class" />
</testng>
<!-- generate a report for Bamboo or Hudson to read in -->
<junitreport todir="${dist.dir}">
<fileset dir="${dist.dir}">
<include name="*/*.xml"/>
</fileset>
<report format="noframes" todir="${dist.dir}"/>
</junitreport>
<fail message="test failed" if="test.failure" />
</sequential>
</macrodef>

View File

@ -11,7 +11,8 @@
<dependency org="net.sf" name="sam" rev="latest.integration"/>
<dependency org="net.sf" name="picard" rev="latest.integration"/>
<dependency org="edu.mit.broad" name="picard-private-parts" rev="latest.integration"/>
<dependency org="junit" name="junit" rev="4.4"/>
<dependency org="org.testng" name="testng" rev="5.14.1" />
<dependency org="log4j" name="log4j" rev="1.2.15">
<!-- Don't include javax.mail here in default, only used in scala->default by commons-email -->
<exclude org="javax.mail" />

View File

@ -62,7 +62,6 @@ public class ManagingReferenceOrderedView implements ReferenceOrderedView {
public void close() {
for( ReferenceOrderedDataState state: states )
state.dataSource.close( state.iterator );
states.clear();
// Clear out the existing data so that post-close() accesses to this data will fail-fast.
states = null;

View File

@ -208,7 +208,6 @@ public class RodLocusView extends LocusView implements ReferenceOrderedView {
public void close() {
for( ReferenceOrderedDataState state: states )
state.dataSource.close( state.iterator );
states.clear();
rodQueue = null;
tracker = null;

View File

@ -25,11 +25,11 @@
package net.sf.picard.reference;
import org.testng.Assert;
import org.broadinstitute.sting.BaseTest;
import org.broadinstitute.sting.gatk.datasources.simpleDataSources.ReferenceDataSourceProgressListener;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.io.File;
import java.io.FileNotFoundException;
@ -44,7 +44,7 @@ public class FastaSequenceIndexBuilderUnitTest extends BaseTest {
private File fastaFile;
private FastaSequenceIndex controlIndex;
@Before
@BeforeMethod
public void doForEachTest() throws FileNotFoundException {
controlIndex = new FastaSequenceIndex();
}
@ -116,4 +116,4 @@ public class FastaSequenceIndexBuilderUnitTest extends BaseTest {
Assert.assertTrue(index.equals(controlIndex));
}
}
}

View File

@ -3,7 +3,7 @@ package org.broadinstitute.sting;
import org.apache.log4j.*;
import org.apache.log4j.spi.LoggingEvent;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import org.junit.*;
import org.testng.annotations.BeforeClass;
import java.io.*;
import java.math.BigInteger;
@ -56,8 +56,7 @@ public abstract class BaseTest {
/** before the class starts up */
@BeforeClass
public static void baseStartup() {
public BaseTest() {
if (!alreadySetup) {
alreadySetup = true;

View File

@ -25,7 +25,6 @@
package org.broadinstitute.sting;
import junit.framework.Assert;
import org.broad.tribble.Tribble;
import org.broad.tribble.index.IndexFactory;
import org.broad.tribble.vcf.VCFCodec;
@ -36,7 +35,8 @@ import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import org.broadinstitute.sting.utils.collections.Pair;
import org.broadinstitute.sting.utils.Utils;
import org.broadinstitute.sting.utils.exceptions.StingException;
import org.junit.Test;
import org.testng.Assert;
import org.testng.annotations.Test;
import org.apache.commons.io.FileUtils;
import java.io.File;
@ -133,7 +133,7 @@ public class WalkerTest extends BaseTest {
// todo -- add support for simple inline display of the first N differences for text file
}
Assert.assertEquals(name + " Mismatching MD5s", expectedMD5, filemd5sum);
Assert.assertEquals(filemd5sum,expectedMD5,name + " Mismatching MD5s");
System.out.println(String.format(" => %s PASSED", name));
}

View File

@ -1,6 +1,6 @@
package org.broadinstitute.sting.alignment;
import org.junit.Test;
import org.testng.annotations.Test;
import org.broadinstitute.sting.WalkerTest;
import java.util.Arrays;

View File

@ -25,13 +25,12 @@
package org.broadinstitute.sting.commandline;
import org.testng.Assert;
import org.broadinstitute.sting.BaseTest;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import org.junit.Test;
import org.junit.Before;
import org.junit.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.util.Collections;
import java.util.List;
import java.util.EnumSet;
/**
@ -40,7 +39,7 @@ import java.util.EnumSet;
public class ParsingEngineUnitTest extends BaseTest {
private ParsingEngine parsingEngine;
@Before
@BeforeMethod
public void setUp() {
parsingEngine = new ParsingEngine(null);
}
@ -61,7 +60,7 @@ public class ParsingEngineUnitTest extends BaseTest {
InputFileArgProvider argProvider = new InputFileArgProvider();
parsingEngine.loadArgumentsIntoObject( argProvider );
Assert.assertEquals("Argument is not correctly initialized", "na12878.bam", argProvider.inputFile );
Assert.assertEquals(argProvider.inputFile,"na12878.bam","Argument is not correctly initialized");
}
@Test
@ -75,7 +74,7 @@ public class ParsingEngineUnitTest extends BaseTest {
MultiCharShortNameArgProvider argProvider = new MultiCharShortNameArgProvider();
parsingEngine.loadArgumentsIntoObject( argProvider );
Assert.assertEquals("Argument is not correctly initialized", "out.txt", argProvider.outputFile );
Assert.assertEquals(argProvider.outputFile,"out.txt","Argument is not correctly initialized");
}
@ -95,7 +94,7 @@ public class ParsingEngineUnitTest extends BaseTest {
InputFileArgProvider argProvider = new InputFileArgProvider();
parsingEngine.loadArgumentsIntoObject( argProvider );
Assert.assertEquals("Argument is not correctly initialized", "na12878.bam", argProvider.inputFile );
Assert.assertEquals(argProvider.inputFile,"na12878.bam","Argument is not correctly initialized");
}
@Test
@ -109,7 +108,7 @@ public class ParsingEngineUnitTest extends BaseTest {
InputFileArgProvider argProvider = new InputFileArgProvider();
parsingEngine.loadArgumentsIntoObject( argProvider );
Assert.assertEquals("Argument is not correctly initialized", "na12878.bam", argProvider.inputFile );
Assert.assertEquals(argProvider.inputFile,"na12878.bam","Argument is not correctly initialized");
}
@Test
@ -123,7 +122,7 @@ public class ParsingEngineUnitTest extends BaseTest {
PrimitiveArgProvider argProvider = new PrimitiveArgProvider();
parsingEngine.loadArgumentsIntoObject( argProvider );
Assert.assertEquals("Argument is not correctly initialized", 5, argProvider.foo );
Assert.assertEquals(argProvider.foo, 5, "Argument is not correctly initialized");
}
private class PrimitiveArgProvider {
@ -142,7 +141,7 @@ public class ParsingEngineUnitTest extends BaseTest {
AllLociArgProvider argProvider = new AllLociArgProvider();
parsingEngine.loadArgumentsIntoObject( argProvider );
Assert.assertTrue("Argument is not correctly initialized", argProvider.allLoci );
Assert.assertTrue(argProvider.allLoci,"Argument is not correctly initialized");
}
private class AllLociArgProvider {
@ -161,9 +160,9 @@ public class ParsingEngineUnitTest extends BaseTest {
MultiValueArgProvider argProvider = new MultiValueArgProvider();
parsingEngine.loadArgumentsIntoObject( argProvider );
Assert.assertEquals("Argument array is of incorrect length", 2, argProvider.inputFile.length);
Assert.assertEquals("1st filename is incorrect", "foo.txt", argProvider.inputFile[0] );
Assert.assertEquals("2nd filename is incorrect", "bar.txt", argProvider.inputFile[1] );
Assert.assertEquals(argProvider.inputFile.length, 2, "Argument array is of incorrect length");
Assert.assertEquals(argProvider.inputFile[0],"foo.txt","1st filename is incorrect");
Assert.assertEquals(argProvider.inputFile[1],"bar.txt","2nd filename is incorrect");
}
private class MultiValueArgProvider {
@ -182,7 +181,7 @@ public class ParsingEngineUnitTest extends BaseTest {
EnumArgProvider argProvider = new EnumArgProvider();
parsingEngine.loadArgumentsIntoObject( argProvider );
Assert.assertEquals("Enum value is not correct", TestEnum.TWO, argProvider.testEnum);
Assert.assertEquals(argProvider.testEnum, TestEnum.TWO, "Enum value is not correct");
}
@Test
@ -196,7 +195,7 @@ public class ParsingEngineUnitTest extends BaseTest {
EnumArgProvider argProvider = new EnumArgProvider();
parsingEngine.loadArgumentsIntoObject( argProvider );
Assert.assertEquals("Enum value is not correct", TestEnum.ONE, argProvider.testEnum);
Assert.assertEquals(argProvider.testEnum, TestEnum.ONE, "Enum value is not correct");
}
@Test
@ -210,7 +209,7 @@ public class ParsingEngineUnitTest extends BaseTest {
EnumArgProvider argProvider = new EnumArgProvider();
parsingEngine.loadArgumentsIntoObject( argProvider );
Assert.assertEquals("Enum value is not correct", TestEnum.THREE, argProvider.testEnum);
Assert.assertEquals(argProvider.testEnum, TestEnum.THREE, "Enum value is not correct");
}
public enum TestEnum { ONE, TWO, THREE }
@ -231,13 +230,13 @@ public class ParsingEngineUnitTest extends BaseTest {
IntegerListArgProvider argProvider = new IntegerListArgProvider();
parsingEngine.loadArgumentsIntoObject( argProvider );
Assert.assertNotNull("Argument array is null",argProvider.integers);
Assert.assertEquals("Argument array is of incorrect length", 5, argProvider.integers.size());
Assert.assertEquals("1st integer is incorrect", 2, argProvider.integers.get(0).intValue() );
Assert.assertEquals("2nd integer is incorrect", 4, argProvider.integers.get(1).intValue() );
Assert.assertEquals("3rd integer is incorrect", 6, argProvider.integers.get(2).intValue() );
Assert.assertEquals("4th integer is incorrect", 8, argProvider.integers.get(3).intValue() );
Assert.assertEquals("5th integer is incorrect",10, argProvider.integers.get(4).intValue() );
Assert.assertNotNull(argProvider.integers, "Argument array is null");
Assert.assertEquals(argProvider.integers.size(), 5, "Argument array is of incorrect length");
Assert.assertEquals(argProvider.integers.get(0).intValue(), 2, "1st integer is incorrect");
Assert.assertEquals(argProvider.integers.get(1).intValue(), 4, "2nd integer is incorrect");
Assert.assertEquals(argProvider.integers.get(2).intValue(), 6, "3rd integer is incorrect");
Assert.assertEquals(argProvider.integers.get(3).intValue(), 8, "4th integer is incorrect");
Assert.assertEquals(argProvider.integers.get(4).intValue(), 10, "5th integer is incorrect");
}
private class IntegerListArgProvider {
@ -256,13 +255,13 @@ public class ParsingEngineUnitTest extends BaseTest {
UntypedListArgProvider argProvider = new UntypedListArgProvider();
parsingEngine.loadArgumentsIntoObject( argProvider );
Assert.assertNotNull("Argument array is null",argProvider.integers);
Assert.assertEquals("Argument array is of incorrect length", 5, argProvider.integers.size());
Assert.assertEquals("1st integer is incorrect", "2", argProvider.integers.get(0) );
Assert.assertEquals("2nd integer is incorrect", "4", argProvider.integers.get(1) );
Assert.assertEquals("3rd integer is incorrect", "6", argProvider.integers.get(2) );
Assert.assertEquals("4th integer is incorrect", "8", argProvider.integers.get(3) );
Assert.assertEquals("5th integer is incorrect","10", argProvider.integers.get(4) );
Assert.assertNotNull(argProvider.integers, "Argument array is null");
Assert.assertEquals(argProvider.integers.size(), 5, "Argument array is of incorrect length");
Assert.assertEquals(argProvider.integers.get(0), "2", "1st integer is incorrect");
Assert.assertEquals(argProvider.integers.get(1), "4", "2nd integer is incorrect");
Assert.assertEquals(argProvider.integers.get(2), "6", "3rd integer is incorrect");
Assert.assertEquals(argProvider.integers.get(3), "8", "4th integer is incorrect");
Assert.assertEquals(argProvider.integers.get(4), "10", "5th integer is incorrect");
}
private class UntypedListArgProvider {
@ -270,7 +269,7 @@ public class ParsingEngineUnitTest extends BaseTest {
public List integers;
}
@Test(expected=MissingArgumentException.class)
@Test(expectedExceptions=MissingArgumentException.class)
public void requiredArgTest() {
final String[] commandLine = new String[0];
@ -296,7 +295,7 @@ public class ParsingEngineUnitTest extends BaseTest {
DefaultValueArgProvider argProvider = new DefaultValueArgProvider();
parsingEngine.loadArgumentsIntoObject( argProvider );
Assert.assertEquals("Default value is not correctly initialized", 42, argProvider.value.intValue() );
Assert.assertEquals(argProvider.value.intValue(), 42, "Default value is not correctly initialized");
// Then try to override it.
commandLine = new String[] { "--value", "27" };
@ -306,7 +305,7 @@ public class ParsingEngineUnitTest extends BaseTest {
parsingEngine.loadArgumentsIntoObject( argProvider );
Assert.assertEquals("Default value is not correctly initialized", 27, argProvider.value.intValue() );
Assert.assertEquals(argProvider.value.intValue(), 27, "Default value is not correctly initialized");
}
private class DefaultValueArgProvider {
@ -325,7 +324,7 @@ public class ParsingEngineUnitTest extends BaseTest {
RequiredArgProvider argProvider = new RequiredArgProvider();
parsingEngine.loadArgumentsIntoObject(argProvider );
Assert.assertNull("Value should have remain unset",argProvider.value);
Assert.assertNull(argProvider.value, "Value should have remain unset");
}
@Test
@ -339,7 +338,7 @@ public class ParsingEngineUnitTest extends BaseTest {
UnrequiredArgProvider argProvider = new UnrequiredArgProvider();
parsingEngine.loadArgumentsIntoObject( argProvider );
Assert.assertNull( "Value was unrequired and unspecified; contents should be null", argProvider.value );
Assert.assertNull(argProvider.value, "Value was unrequired and unspecified; contents should be null");
}
private class UnrequiredArgProvider {
@ -347,7 +346,7 @@ public class ParsingEngineUnitTest extends BaseTest {
public Integer value;
}
@Test(expected=InvalidArgumentException.class)
@Test(expectedExceptions=InvalidArgumentException.class)
public void invalidArgTest() {
final String[] commandLine = new String[] { "--foo" };
@ -356,7 +355,7 @@ public class ParsingEngineUnitTest extends BaseTest {
parsingEngine.validate();
}
@Test(expected= ReviewedStingException.class)
@Test(expectedExceptions= ReviewedStingException.class)
public void duplicateLongNameTest() {
parsingEngine.addArgumentSource( DuplicateLongNameProvider.class );
}
@ -369,7 +368,7 @@ public class ParsingEngineUnitTest extends BaseTest {
public Integer bar;
}
@Test(expected= ReviewedStingException.class)
@Test(expectedExceptions= ReviewedStingException.class)
public void duplicateShortNameTest() {
parsingEngine.addArgumentSource( DuplicateShortNameProvider.class );
}
@ -383,7 +382,7 @@ public class ParsingEngineUnitTest extends BaseTest {
public Integer bar;
}
@Test(expected=UnmatchedArgumentException.class)
@Test(expectedExceptions=UnmatchedArgumentException.class)
public void missingArgumentNameTest() {
final String[] commandLine = new String[] {"foo.txt"};
@ -396,7 +395,7 @@ public class ParsingEngineUnitTest extends BaseTest {
}
@Test(expected=UnmatchedArgumentException.class)
@Test(expectedExceptions=UnmatchedArgumentException.class)
public void extraValueTest() {
final String[] commandLine = new String[] {"-I", "foo.txt", "bar.txt"};
@ -405,7 +404,7 @@ public class ParsingEngineUnitTest extends BaseTest {
parsingEngine.validate();
}
@Test(expected=MissingArgumentException.class)
@Test(expectedExceptions=MissingArgumentException.class)
public void multipleInvalidArgTest() {
final String[] commandLine = new String[] {"-N1", "-N2", "-N3"};
@ -414,7 +413,7 @@ public class ParsingEngineUnitTest extends BaseTest {
parsingEngine.validate();
}
@Test(expected=TooManyValuesForArgumentException.class)
@Test(expectedExceptions=TooManyValuesForArgumentException.class)
public void invalidArgCountTest() {
final String[] commandLine = new String[] {"--value","1","--value","2","--value","3"};
@ -434,7 +433,7 @@ public class ParsingEngineUnitTest extends BaseTest {
PackageProtectedArgProvider argProvider = new PackageProtectedArgProvider();
parsingEngine.loadArgumentsIntoObject(argProvider);
Assert.assertEquals("Argument is not correctly initialized", 1, argProvider.foo.intValue() );
Assert.assertEquals(argProvider.foo.intValue(), 1, "Argument is not correctly initialized");
}
private class PackageProtectedArgProvider {
@ -453,7 +452,7 @@ public class ParsingEngineUnitTest extends BaseTest {
DerivedArgProvider argProvider = new DerivedArgProvider();
parsingEngine.loadArgumentsIntoObject(argProvider);
Assert.assertEquals("Argument is not correctly initialized", 5, argProvider.bar.intValue() );
Assert.assertEquals(argProvider.bar.intValue(), 5, "Argument is not correctly initialized");
}
private class DerivedArgProvider extends BaseArgProvider {
@ -471,7 +470,7 @@ public class ParsingEngineUnitTest extends BaseTest {
DefinitionMatcher matcher = ArgumentDefinitions.FullNameDefinitionMatcher;
ArgumentDefinition definition = parsingEngine.argumentDefinitions.findArgumentDefinition("myarg", matcher);
Assert.assertNotNull("Invalid default argument name assigned", definition );
Assert.assertNotNull(definition, "Invalid default argument name assigned");
}
private class CamelCaseArgProvider {
@ -479,7 +478,7 @@ public class ParsingEngineUnitTest extends BaseTest {
Integer myArg;
}
@Test(expected=UnmatchedArgumentException.class)
@Test(expectedExceptions=UnmatchedArgumentException.class)
public void booleanWithParameterTest() {
final String[] commandLine = new String[] {"--mybool", "true"};
@ -504,7 +503,7 @@ public class ParsingEngineUnitTest extends BaseTest {
AnalysisTypeArgProvider argProvider = new AnalysisTypeArgProvider();
parsingEngine.loadArgumentsIntoObject( argProvider );
Assert.assertEquals("Argument is not correctly initialized", "Pileup", argProvider.Analysis_Name );
Assert.assertEquals(argProvider.Analysis_Name,"Pileup","Argument is not correctly initialized");
}
private class AnalysisTypeArgProvider {
@ -512,7 +511,7 @@ public class ParsingEngineUnitTest extends BaseTest {
public String Analysis_Name = null;
}
@Test(expected=TooManyValuesForArgumentException.class)
@Test(expectedExceptions=TooManyValuesForArgumentException.class)
public void invalidParseForAnalysisTypeTest() {
final String[] commandLine = new String[] {"--analysis_type", "Pileup", "-T", "CountReads" };
@ -521,7 +520,7 @@ public class ParsingEngineUnitTest extends BaseTest {
parsingEngine.validate( EnumSet.of(ParsingEngine.ValidationType.MissingRequiredArgument) );
}
@Test(expected=ArgumentsAreMutuallyExclusiveException.class)
@Test(expectedExceptions=ArgumentsAreMutuallyExclusiveException.class)
public void mutuallyExclusiveArgumentsTest() {
// Passing only foo should work fine...
String[] commandLine = new String[] {"--foo","5"};
@ -533,7 +532,7 @@ public class ParsingEngineUnitTest extends BaseTest {
MutuallyExclusiveArgProvider argProvider = new MutuallyExclusiveArgProvider();
parsingEngine.loadArgumentsIntoObject( argProvider );
Assert.assertEquals("Argument is not correctly initialized", 5, argProvider.foo.intValue() );
Assert.assertEquals(argProvider.foo.intValue(), 5, "Argument is not correctly initialized");
// But when foo and bar come together, danger!
commandLine = new String[] {"--foo","5","--bar","6"};
@ -550,7 +549,7 @@ public class ParsingEngineUnitTest extends BaseTest {
Integer bar;
}
@Test(expected=InvalidArgumentValueException.class)
@Test(expectedExceptions=InvalidArgumentValueException.class)
public void argumentValidationTest() {
// Passing only foo should work fine...
String[] commandLine = new String[] {"--value","521"};
@ -562,7 +561,7 @@ public class ParsingEngineUnitTest extends BaseTest {
ValidatingArgProvider argProvider = new ValidatingArgProvider();
parsingEngine.loadArgumentsIntoObject( argProvider );
Assert.assertEquals("Argument is not correctly initialized", 521, argProvider.value.intValue() );
Assert.assertEquals(argProvider.value.intValue(), 521, "Argument is not correctly initialized");
// Try some invalid arguments
commandLine = new String[] {"--value","foo"};
@ -586,7 +585,7 @@ public class ParsingEngineUnitTest extends BaseTest {
ArgumentCollectionProvider argProvider = new ArgumentCollectionProvider();
parsingEngine.loadArgumentsIntoObject(argProvider);
Assert.assertEquals("Argument is not correctly initialized", 5, argProvider.rap.value.intValue() );
Assert.assertEquals(argProvider.rap.value.intValue(), 5, "Argument is not correctly initialized");
}
private class ArgumentCollectionProvider {
@ -594,7 +593,7 @@ public class ParsingEngineUnitTest extends BaseTest {
RequiredArgProvider rap = new RequiredArgProvider();
}
@Test(expected= ReviewedStingException.class)
@Test(expectedExceptions= ReviewedStingException.class)
public void multipleArgumentCollectionTest() {
parsingEngine.addArgumentSource( MultipleArgumentCollectionProvider.class );
}

View File

@ -24,9 +24,10 @@
package org.broadinstitute.sting.datasources.pipeline;
import org.testng.Assert;
import org.broadinstitute.sting.utils.yaml.YamlUtils;
import org.junit.Assert;
import org.junit.Test;
import org.testng.annotations.Test;
import java.io.File;
import java.util.Map;
@ -53,29 +54,29 @@ public class PipelineUnitTest {
YamlUtils.dump(pipeline, file);
Pipeline pipelineLoad = YamlUtils.load(Pipeline.class, file);
Assert.assertEquals(pipeline.getProject().getName(), pipelineLoad.getProject().getName());
Assert.assertEquals(pipelineLoad.getProject().getName(), pipeline.getProject().getName());
Assert.assertEquals(pipeline.getProject().getReferenceFile(), pipelineLoad.getProject().getReferenceFile());
Assert.assertEquals(pipeline.getProject().getIntervalList(), pipelineLoad.getProject().getIntervalList());
Assert.assertEquals(pipeline.getProject().getDbsnpFile(), pipelineLoad.getProject().getDbsnpFile());
Assert.assertEquals(pipeline.getProject().getTags().size(), pipelineLoad.getProject().getTags().size());
Assert.assertEquals(pipelineLoad.getProject().getTags().size(), pipeline.getProject().getTags().size());
for (Map.Entry<String, String> entry : pipeline.getProject().getTags().entrySet())
Assert.assertEquals(entry.getValue(), pipeline.getProject().getTags().get(entry.getKey()));
Assert.assertEquals(pipeline.getProject().getTags().get(entry.getKey()), entry.getValue());
Assert.assertEquals(pipeline.getSamples().size(), pipelineLoad.getSamples().size());
Assert.assertEquals(pipelineLoad.getSamples().size(), pipeline.getSamples().size());
for (int i = 0; i < pipeline.getSamples().size(); i++) {
PipelineSample pipelineSample = pipeline.getSamples().get(i);
PipelineSample pipelineLoadSample = pipelineLoad.getSamples().get(i);
Assert.assertEquals(pipelineSample.getId(), pipelineLoadSample.getId());
Assert.assertEquals(pipelineLoadSample.getId(), pipelineSample.getId());
Assert.assertEquals(pipelineSample.getBamFiles().size(), pipelineLoadSample.getBamFiles().size());
Assert.assertEquals(pipelineLoadSample.getBamFiles().size(), pipelineSample.getBamFiles().size());
for (Map.Entry<String, File> entry : pipelineSample.getBamFiles().entrySet())
Assert.assertEquals(entry.getValue(), pipelineSample.getBamFiles().get(entry.getKey()));
Assert.assertEquals(pipelineSample.getTags().size(), pipelineLoadSample.getTags().size());
Assert.assertEquals(pipelineLoadSample.getTags().size(), pipelineSample.getTags().size());
for (Map.Entry<String, String> entry : pipelineSample.getTags().entrySet())
Assert.assertEquals(entry.getValue(), pipelineSample.getTags().get(entry.getKey()));
Assert.assertEquals(pipelineSample.getTags().get(entry.getKey()), entry.getValue());
}
}
}

View File

@ -24,15 +24,16 @@
package org.broadinstitute.sting.gatk;
import org.testng.Assert;
import org.broadinstitute.sting.commandline.Hidden;
import org.broadinstitute.sting.gatk.walkers.Requires;
import org.broadinstitute.sting.gatk.walkers.Walker;
import org.broadinstitute.sting.gatk.walkers.qc.CountLociWalker;
import org.broadinstitute.sting.utils.exceptions.DynamicClassResolutionException;
import org.broadinstitute.sting.utils.exceptions.UserException;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
/**
* Tests basic functionality of the walker manager.
@ -41,7 +42,7 @@ public class WalkerManagerUnitTest {
private static WalkerManager walkerManager;
@BeforeClass
public static void setUp() {
public void setUp() {
walkerManager = new WalkerManager();
}
@ -51,12 +52,12 @@ public class WalkerManagerUnitTest {
Assert.assertEquals(CountLociWalker.class,countLociWalker.getClass());
}
@Test(expected=UserException.class)
@Test(expectedExceptions=UserException.class)
public void testAbsentWalker() {
walkerManager.createByName("Missing");
}
@Test(expected=DynamicClassResolutionException.class)
@Test(expectedExceptions=DynamicClassResolutionException.class)
public void testUninstantiableWalker() {
walkerManager.createByName("Uninstantiable");
}
@ -69,4 +70,4 @@ class UninstantiableWalker extends Walker<Integer,Long> {
private UninstantiableWalker() {}
public Long reduceInit() { return 0L; }
public Long reduce(Integer value, Long accum) { return 0L; }
}
}

View File

@ -1,10 +1,10 @@
package org.broadinstitute.sting.gatk.arguments;
import org.broadinstitute.sting.BaseTest;
import org.junit.After;
import static org.junit.Assert.fail;
import org.junit.Before;
import org.junit.Test;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import static org.testng.Assert.fail;
import java.io.File;
import java.util.*;
@ -54,13 +54,13 @@ public class GATKArgumentCollectionUnitTest extends BaseTest {
private String xmlFileLoc = "testfile.xml";
/** setup our test */
@Before
@BeforeMethod
public void setup() {
collect = new GATKArgumentCollection();
}
/** destroy the temp file */
@After
@AfterMethod
public void takedown() {
File f = new File(xmlFileLoc);
if (f.exists()) {

View File

@ -2,7 +2,7 @@
package org.broadinstitute.sting.gatk.contexts.variantcontext;
import org.broadinstitute.sting.WalkerTest;
import org.junit.Test;
import org.testng.annotations.Test;
import java.util.HashMap;
import java.util.Map;

View File

@ -26,14 +26,15 @@ package org.broadinstitute.sting.gatk.contexts.variantcontext;
import net.sf.samtools.SAMFileHeader;
import org.broad.tribble.util.variantcontext.Allele;
import org.broad.tribble.util.variantcontext.VariantContext;
import org.testng.Assert;
import org.broadinstitute.sting.BaseTest;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.GenomeLocParser;
import org.broadinstitute.sting.utils.sam.ArtificialSAMUtils;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.util.Arrays;
import java.util.List;
@ -59,7 +60,7 @@ public class VariantJEXLContextUnitTest extends BaseTest {
Allele del, delRef, ATC, ATCref;
// A [ref] / T at 10
GenomeLoc snpLoc = GenomeLocParser.createGenomeLoc("chr1", 10, 10);
GenomeLoc snpLoc;
// - / ATC [ref] from 20-23
private static int startingChr = 1;
@ -69,7 +70,7 @@ public class VariantJEXLContextUnitTest extends BaseTest {
static SAMFileHeader header;
@BeforeClass
public static void beforeClass() {
public void beforeClass() {
header = ArtificialSAMUtils.createArtificialSamHeader(( endingChr - startingChr ) + 1, startingChr, readCount + DEFAULT_READ_LENGTH);
GenomeLocParser.setupRefContigOrdering(header.getSequenceDictionary());
try {
@ -77,9 +78,10 @@ public class VariantJEXLContextUnitTest extends BaseTest {
} catch (Exception e) {
Assert.fail("Unable to create expression" + e.getMessage());
}
snpLoc = GenomeLocParser.createGenomeLoc("chr1", 10, 10);
}
@Before
@BeforeMethod
public void before() {
del = Allele.create("-");
delRef = Allele.create("-", true);
@ -100,34 +102,34 @@ public class VariantJEXLContextUnitTest extends BaseTest {
// make sure the context has a value
Assert.assertTrue(!map.isEmpty());
Assert.assertEquals(1,map.size());
Assert.assertEquals(map.size(), 1);
// eval our known expression
Assert.assertTrue(!map.get(exp));
}
@Test(expected=UnsupportedOperationException.class)
@Test(expectedExceptions=UnsupportedOperationException.class)
public void testContainsValue() {
Map<VariantContextUtils.JexlVCMatchExp, Boolean> map = getVarContext();
map.containsValue(exp);
}
@Test(expected=UnsupportedOperationException.class)
@Test(expectedExceptions=UnsupportedOperationException.class)
public void testRemove() {
Map<VariantContextUtils.JexlVCMatchExp, Boolean> map = getVarContext();
map.remove(exp);
}
@Test(expected=UnsupportedOperationException.class)
@Test(expectedExceptions=UnsupportedOperationException.class)
public void testEntrySet() {
Map<VariantContextUtils.JexlVCMatchExp, Boolean> map = getVarContext();
map.entrySet();
}
@Test(expected=UnsupportedOperationException.class)
@Test(expectedExceptions=UnsupportedOperationException.class)
public void testClear() {
Map<VariantContextUtils.JexlVCMatchExp, Boolean> map = getVarContext();

View File

@ -1,6 +1,7 @@
package org.broadinstitute.sting.gatk.datasources.providers;
import org.junit.Assert;
import org.testng.Assert;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.GenomeLocParser;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
@ -48,17 +49,17 @@ public class AllLocusViewUnitTest extends LocusViewTemplate {
for( long i = bounds.getStart(); i <= bounds.getStop(); i++ ) {
GenomeLoc site = GenomeLocParser.createGenomeLoc("chr1",i);
AlignmentContext locusContext = allLocusView.next();
Assert.assertEquals("Locus context location is incorrect", site, locusContext.getLocation() );
Assert.assertEquals(locusContext.getLocation(), site, "Locus context location is incorrect");
int expectedReadsAtSite = 0;
for( SAMRecord read: reads ) {
if(GenomeLocParser.createGenomeLoc(read).containsP(locusContext.getLocation())) {
Assert.assertTrue("Target locus context does not contain reads", locusContext.getReads().contains(read) );
Assert.assertTrue(locusContext.getReads().contains(read),"Target locus context does not contain reads");
expectedReadsAtSite++;
}
}
Assert.assertEquals("Found wrong number of reads at site", expectedReadsAtSite, locusContext.getReads().size());
Assert.assertEquals(locusContext.getReads().size(), expectedReadsAtSite, "Found wrong number of reads at site");
}
}

View File

@ -1,6 +1,7 @@
package org.broadinstitute.sting.gatk.datasources.providers;
import org.junit.Assert;
import org.testng.Assert;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.GenomeLocParser;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
@ -60,18 +61,18 @@ public class CoveredLocusViewUnitTest extends LocusViewTemplate {
if( expectedReadsAtSite < 1 )
continue;
Assert.assertTrue("Incorrect number of loci in view",coveredLocusView.hasNext());
Assert.assertTrue(coveredLocusView.hasNext(),"Incorrect number of loci in view");
AlignmentContext locusContext = coveredLocusView.next();
Assert.assertEquals("Target locus context location is incorrect", site, locusContext.getLocation() );
Assert.assertEquals("Found wrong number of reads at site", expectedReadsAtSite, locusContext.getReads().size());
Assert.assertEquals(locusContext.getLocation(), site, "Target locus context location is incorrect");
Assert.assertEquals(locusContext.getReads().size(), expectedReadsAtSite, "Found wrong number of reads at site");
for( SAMRecord read: reads ) {
if(GenomeLocParser.createGenomeLoc(read).containsP(locusContext.getLocation()))
Assert.assertTrue("Target locus context does not contain reads", locusContext.getReads().contains(read) );
Assert.assertTrue(locusContext.getReads().contains(read),"Target locus context does not contain reads");
}
}
Assert.assertFalse("Iterator is not bounded at boundaries of shard", coveredLocusView.hasNext());
Assert.assertFalse(coveredLocusView.hasNext(),"Iterator is not bounded at boundaries of shard");
}
}

View File

@ -1,7 +1,8 @@
package org.broadinstitute.sting.gatk.datasources.providers;
import org.junit.Test;
import org.junit.Assert;
import org.testng.Assert;
import org.testng.annotations.Test;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.GenomeLocParser;
import org.broadinstitute.sting.gatk.datasources.shards.Shard;
@ -44,7 +45,7 @@ public class LocusReferenceViewUnitTest extends ReferenceViewTemplate {
//
// /** Multiple-base pair queries should generate exceptions. */
// @Test(expected = InvalidPositionException.class)
// @Test(expectedExceptions=InvalidPositionException.class)
// public void testSingleBPFailure() {
// Shard shard = new LocusShard(GenomeLocParser.createGenomeLoc(0, 1, 50));
//
@ -62,7 +63,7 @@ public class LocusReferenceViewUnitTest extends ReferenceViewTemplate {
byte[] results = view.getReferenceBases(GenomeLocParser.createGenomeLoc(0, sequenceFile.getSequence("chrM").length() - 10, sequenceFile.getSequence("chrM").length() + 9));
System.out.printf("results are %s%n", new String(results));
Assert.assertEquals(20, results.length);
Assert.assertEquals(results.length, 20);
for (int x = 0; x < results.length; x++) {
if (x <= 10) Assert.assertTrue(results[x] != 'X');
else Assert.assertTrue(results[x] == 'X');
@ -106,9 +107,8 @@ public class LocusReferenceViewUnitTest extends ReferenceViewTemplate {
char expected = Character.toUpperCase(StringUtil.bytesToString(expectedAsSeq.getBases()).charAt(0));
char actual = view.getReferenceContext(locus).getBaseAsChar();
Assert.assertEquals(String.format("Value of base at position %s in shard %s does not match expected", locus.toString(), shard.getGenomeLocs()),
expected,
actual);
Assert.assertEquals(actual, expected, String.format("Value of base at position %s in shard %s does not match expected", locus.toString(), shard.getGenomeLocs())
);
}
}

View File

@ -16,8 +16,9 @@ import org.broadinstitute.sting.gatk.iterators.StingSAMIterator;
import org.broadinstitute.sting.gatk.iterators.LocusIteratorByState;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.GenomeLocParser;
import org.junit.BeforeClass;
import org.junit.Test;
import org.broadinstitute.sting.utils.GenomeLocParserTestUtils;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.io.FileNotFoundException;
import java.util.*;
@ -40,7 +41,8 @@ public abstract class LocusViewTemplate extends BaseTest {
protected static ReferenceSequenceFile sequenceSourceFile = null;
@BeforeClass
public static void setupGenomeLoc() throws FileNotFoundException {
public void setupGenomeLoc() throws FileNotFoundException {
GenomeLocParserTestUtils.clearSequenceDictionary();
sequenceSourceFile = fakeReferenceSequenceFile();
GenomeLocParser.setupRefContigOrdering(sequenceSourceFile);
}

View File

@ -25,6 +25,7 @@ package org.broadinstitute.sting.gatk.datasources.providers;
import net.sf.samtools.SAMFileHeader;
import net.sf.samtools.SAMRecord;
import org.testng.Assert;
import org.broadinstitute.sting.BaseTest;
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTracker;
import org.broadinstitute.sting.gatk.refdata.ReadMetaDataTrackerUnitTest;
@ -34,10 +35,11 @@ import org.broadinstitute.sting.gatk.refdata.utils.RODRecordList;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.GenomeLocParser;
import org.broadinstitute.sting.utils.sam.ArtificialSAMUtils;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.util.*;
@ -58,12 +60,12 @@ public class ReadBasedReferenceOrderedViewUnitTest extends BaseTest {
private static SAMFileHeader header;
@BeforeClass
public static void beforeClass() {
public void beforeClass() {
header = ArtificialSAMUtils.createArtificialSamHeader((endingChr - startingChr) + 1, startingChr, readCount + DEFAULT_READ_LENGTH);
GenomeLocParser.setupRefContigOrdering(header.getSequenceDictionary());
}
@Before
@BeforeMethod
public void beforeEach() {
}
@ -83,9 +85,9 @@ public class ReadBasedReferenceOrderedViewUnitTest extends BaseTest {
ReadMetaDataTracker tracker = view.getReferenceOrderedDataForRead(rec);
Map<Long, Collection<GATKFeature>> map = tracker.getReadOffsetMapping();
for (Long i : map.keySet()) {
Assert.assertEquals(1, map.get(i).size());
Assert.assertEquals(map.get(i).size(), 1);
}
Assert.assertEquals(10, map.keySet().size());
Assert.assertEquals(map.keySet().size(), 10);
}
}
@ -180,4 +182,4 @@ class FakeRODRecordList extends AbstractList<GATKFeature> implements RODRecordLi
public int compareTo(RODRecordList rodRecordList) {
return this.list.get(0).getLocation().compareTo(rodRecordList.getLocation());
}
}
}

View File

@ -1,11 +1,11 @@
package org.broadinstitute.sting.gatk.datasources.providers;
import org.testng.Assert;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.junit.Assert;
import org.junit.Test;
import org.testng.annotations.Test;
import net.sf.samtools.*;
import net.sf.samtools.util.StringUtil;
import net.sf.picard.reference.ReferenceSequence;
/*
@ -79,8 +79,8 @@ public class ReadReferenceViewUnitTest extends ReferenceViewTemplate {
byte[] expected = expectedAsSeq.getBases();
byte[] actual = view.getReferenceBases(rec);
Assert.assertEquals(expected.length, (readLength - overlap));
Assert.assertEquals(actual.length, readLength);
Assert.assertEquals((readLength - overlap), expected.length);
Assert.assertEquals(readLength, actual.length);
int xRange = 0;
for (; xRange < (readLength - overlap); xRange++) {
Assert.assertTrue(actual[xRange] != 'X');
@ -105,9 +105,7 @@ public class ReadReferenceViewUnitTest extends ReferenceViewTemplate {
byte[] expected = expectedAsSeq.getBases();
byte[] actual = view.getReferenceBases(read);
Assert.assertArrayEquals(String.format("Base array at in shard %s does not match expected",loc.toString()),
expected,
actual);
org.testng.Assert.assertEquals(actual,expected,String.format("Base array at in shard %s does not match expected",loc.toString()));
}

View File

@ -1,19 +1,19 @@
package org.broadinstitute.sting.gatk.datasources.providers;
import org.testng.Assert;
import org.broadinstitute.sting.BaseTest;
import org.broadinstitute.sting.gatk.datasources.shards.Shard;
import org.broadinstitute.sting.gatk.datasources.shards.MockLocusShard;
import org.broadinstitute.sting.gatk.datasources.simpleDataSources.ReferenceOrderedDataSource;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedData;
import org.broadinstitute.sting.gatk.refdata.features.table.TableCodec;
import org.broadinstitute.sting.gatk.refdata.features.table.TableFeature;
import org.broadinstitute.sting.gatk.refdata.tracks.RMDTrack;
import org.broadinstitute.sting.gatk.refdata.tracks.builders.RMDTrackBuilder;
import org.broadinstitute.sting.utils.GenomeLocParser;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.io.File;
import java.io.FileNotFoundException;
@ -50,7 +50,7 @@ public class ReferenceOrderedViewUnitTest extends BaseTest {
RMDTrackBuilder builder = new RMDTrackBuilder();
@BeforeClass
public static void init() throws FileNotFoundException {
public void init() throws FileNotFoundException {
// sequence
seq = new IndexedFastaSequenceFile(new File(hg18Reference));
GenomeLocParser.setupRefContigOrdering(seq);
@ -66,7 +66,7 @@ public class ReferenceOrderedViewUnitTest extends BaseTest {
ReferenceOrderedView view = new ManagingReferenceOrderedView( provider );
RefMetaDataTracker tracker = view.getReferenceOrderedDataAtLocus(GenomeLocParser.createGenomeLoc("chrM",10));
Assert.assertEquals("The tracker should not have produced any data", 0, tracker.getAllRods().size());
Assert.assertEquals(tracker.getAllRods().size(), 0, "The tracker should not have produced any data");
}
/**
@ -86,9 +86,9 @@ public class ReferenceOrderedViewUnitTest extends BaseTest {
RefMetaDataTracker tracker = view.getReferenceOrderedDataAtLocus(GenomeLocParser.createGenomeLoc("chrM",20));
TableFeature datum = tracker.lookup("tableTest",TableFeature.class);
Assert.assertEquals("datum parameter for COL1 is incorrect", "C", datum.get("COL1"));
Assert.assertEquals("datum parameter for COL2 is incorrect", "D", datum.get("COL2"));
Assert.assertEquals("datum parameter for COL3 is incorrect", "E", datum.get("COL3"));
Assert.assertEquals(datum.get("COL1"),"C","datum parameter for COL1 is incorrect");
Assert.assertEquals(datum.get("COL2"),"D","datum parameter for COL2 is incorrect");
Assert.assertEquals(datum.get("COL3"),"E","datum parameter for COL3 is incorrect");
}
/**
@ -113,14 +113,14 @@ public class ReferenceOrderedViewUnitTest extends BaseTest {
RefMetaDataTracker tracker = view.getReferenceOrderedDataAtLocus(GenomeLocParser.createGenomeLoc("chrM",20));
TableFeature datum1 = tracker.lookup("tableTest1",TableFeature.class);
Assert.assertEquals("datum1 parameter for COL1 is incorrect", "C", datum1.get("COL1"));
Assert.assertEquals("datum1 parameter for COL2 is incorrect", "D", datum1.get("COL2"));
Assert.assertEquals("datum1 parameter for COL3 is incorrect", "E", datum1.get("COL3"));
Assert.assertEquals(datum1.get("COL1"),"C","datum1 parameter for COL1 is incorrect");
Assert.assertEquals(datum1.get("COL2"),"D","datum1 parameter for COL2 is incorrect");
Assert.assertEquals(datum1.get("COL3"),"E","datum1 parameter for COL3 is incorrect");
TableFeature datum2 = tracker.lookup("tableTest2", TableFeature.class);
Assert.assertEquals("datum2 parameter for COL1 is incorrect", "C", datum2.get("COL1"));
Assert.assertEquals("datum2 parameter for COL2 is incorrect", "D", datum2.get("COL2"));
Assert.assertEquals("datum2 parameter for COL3 is incorrect", "E", datum2.get("COL3"));
Assert.assertEquals(datum2.get("COL1"),"C","datum2 parameter for COL1 is incorrect");
Assert.assertEquals(datum2.get("COL2"),"D","datum2 parameter for COL2 is incorrect");
Assert.assertEquals(datum2.get("COL3"),"E","datum2 parameter for COL3 is incorrect");
}
}

View File

@ -5,8 +5,9 @@ import net.sf.picard.reference.IndexedFastaSequenceFile;
import org.broadinstitute.sting.BaseTest;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.GenomeLocParser;
import org.junit.BeforeClass;
import org.junit.Test;
import org.broadinstitute.sting.utils.GenomeLocParserTestUtils;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.io.File;
import java.io.FileNotFoundException;
@ -41,7 +42,8 @@ public abstract class ReferenceViewTemplate extends BaseTest {
* Initialize the fasta.
*/
@BeforeClass
public static void initialize() throws FileNotFoundException {
public void initialize() throws FileNotFoundException {
GenomeLocParserTestUtils.clearSequenceDictionary();
sequenceFile = new IndexedFastaSequenceFile( new File(hg18Reference) );
GenomeLocParser.setupRefContigOrdering(sequenceFile);
}

View File

@ -1,9 +1,11 @@
package org.broadinstitute.sting.gatk.datasources.providers;
import org.testng.Assert;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import org.junit.Before;
import org.junit.Assert;
import org.junit.Test;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.broadinstitute.sting.BaseTest;
import java.util.Collection;
@ -32,7 +34,7 @@ public class ShardDataProviderUnitTest extends BaseTest {
*/
private ShardDataProvider provider = null;
@Before
@BeforeMethod
public void createProvider() {
provider = new LocusShardDataProvider( null,null,null,null,null,null );
}
@ -43,10 +45,10 @@ public class ShardDataProviderUnitTest extends BaseTest {
@Test
public void testClose() {
TestView testView = new TestView( provider );
Assert.assertFalse("View is currently closed but should be open", testView.closed);
Assert.assertFalse(testView.closed,"View is currently closed but should be open");
provider.close();
Assert.assertTrue("View is currently open but should be closed", testView.closed);
Assert.assertTrue(testView.closed,"View is currently open but should be closed");
}
/**
@ -56,17 +58,17 @@ public class ShardDataProviderUnitTest extends BaseTest {
public void testMultipleClose() {
Collection<TestView> testViews = Arrays.asList(new TestView(provider),new TestView(provider));
for( TestView testView: testViews )
Assert.assertFalse("View is currently closed but should be open", testView.closed);
Assert.assertFalse(testView.closed,"View is currently closed but should be open");
provider.close();
for( TestView testView: testViews )
Assert.assertTrue("View is currently open but should be closed", testView.closed);
Assert.assertTrue(testView.closed,"View is currently open but should be closed");
}
/**
* Try adding a view which conflicts with some other view that's already been registered.
*/
@Test(expected= ReviewedStingException.class)
@Test(expectedExceptions= ReviewedStingException.class)
public void testAddViewWithExistingConflict() {
View initial = new ConflictingTestView( provider );
View conflictsWithInitial = new TestView( provider );
@ -75,7 +77,7 @@ public class ShardDataProviderUnitTest extends BaseTest {
/**
* Try adding a view which has a conflict with a previously registered view.
*/
@Test(expected= ReviewedStingException.class)
@Test(expectedExceptions= ReviewedStingException.class)
public void testAddViewWithNewConflict() {
View conflictsWithInitial = new TestView( provider );
View initial = new ConflictingTestView( provider );

View File

@ -4,10 +4,11 @@ import net.sf.samtools.SAMFileHeader;
import org.broad.tribble.util.variantcontext.Allele;
import org.broad.tribble.util.variantcontext.Genotype;
import org.broad.tribble.util.variantcontext.VariantContext;
import org.testng.Assert;
import org.broadinstitute.sting.BaseTest;
import org.broadinstitute.sting.utils.exceptions.StingException;
import org.junit.Assert;
import org.junit.Test;
import org.testng.annotations.Test;
import java.io.File;
import java.util.*;
@ -50,14 +51,14 @@ public class SampleDataSourceUnitTest extends BaseTest {
}
// but that file should fail if it has an extra character in it...
@Test(expected = StingException.class)
@Test(expectedExceptions=StingException.class)
public void loadInvalidSampleExtraCharText() {
File sampleFile = new File(sampleFilesDir + "invalidSyntaxExtraChar.yaml");
SampleDataSource s = new SampleDataSource(header, makeFileList(sampleFile));
}
// ...or a typo...
@Test(expected = StingException.class)
@Test(expectedExceptions=StingException.class)
public void loadInvalidSampleTypoText() {
File sampleFile = new File(sampleFilesDir + "invalidSyntaxTypo.yaml");
SampleDataSource s = new SampleDataSource(header, makeFileList(sampleFile));
@ -65,14 +66,14 @@ public class SampleDataSourceUnitTest extends BaseTest {
}
// ...or an extra unrecognized array
@Test(expected = StingException.class)
@Test(expectedExceptions=StingException.class)
public void loadInvalidSampleExtraArrayText() {
File sampleFile = new File(sampleFilesDir + "invalidSyntaxExtraArray.yaml");
SampleDataSource s = new SampleDataSource(header, makeFileList(sampleFile));
}
// make sure aliases work
@Test(expected = StingException.class)
@Test(expectedExceptions=StingException.class)
public void sampleAliasText() {
File sampleFile = new File(sampleFilesDir + "basicSampleFileWithAlias.yaml");
SampleDataSource s = new SampleDataSource(header, makeFileList(sampleFile));
@ -82,14 +83,14 @@ public class SampleDataSourceUnitTest extends BaseTest {
}
// error is thrown if property is included that's not in properties array
@Test(expected = StingException.class)
@Test(expectedExceptions=StingException.class)
public void unallowedPropertySampleTest() {
File sampleFile = new File(sampleFilesDir + "basicSampleFileUnallowedProperty.yaml");
SampleDataSource s = new SampleDataSource(header, makeFileList(sampleFile));
}
// same as above, with relationship
@Test(expected = StingException.class)
@Test(expectedExceptions=StingException.class)
public void unallowedRelationshipSampleTest() {
File sampleFile = new File(sampleFilesDir + "basicSampleFileUnallowedRelationship.yaml");
SampleDataSource s = new SampleDataSource(header, makeFileList(sampleFile));
@ -109,7 +110,7 @@ public class SampleDataSourceUnitTest extends BaseTest {
}
// two sample files, with contradictory properties
@Test(expected = StingException.class)
@Test(expectedExceptions=StingException.class)
public void twoContradictorySampleFilesTest() {
File sampleFile = new File(sampleFilesDir + "basicSampleFile.yaml");
File secondFile = new File(sampleFilesDir + "basicSampleFileInvalidExt.yaml");

View File

@ -1,9 +1,10 @@
package org.broadinstitute.sting.gatk.datasources.sample;
import org.testng.Assert;
import org.broadinstitute.sting.BaseTest;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
/**
* Created by IntelliJ IDEA.
@ -19,7 +20,7 @@ public class SampleUnitTest extends BaseTest {
static Sample sampleC;
@BeforeClass
public static void init() {
public void init() {
sampleA = new Sample("sampleA");
sampleA.setProperty("uniqueProperty", "uniqueValue");
sampleA1 = new Sample("sampleA");
@ -60,4 +61,4 @@ public class SampleUnitTest extends BaseTest {
Assert.assertFalse(sampleA.isMale()); // sample A doesn't have a gender, so this should be false
}
}
}

View File

@ -1,7 +1,7 @@
package org.broadinstitute.sting.gatk.datasources.simpleDataSources;
import org.testng.Assert;
import org.broadinstitute.sting.BaseTest;
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedData;
import org.broadinstitute.sting.gatk.refdata.features.table.TableCodec;
import org.broadinstitute.sting.gatk.refdata.features.table.TableFeature;
import org.broadinstitute.sting.gatk.refdata.tracks.RMDTrack;
@ -9,15 +9,15 @@ import org.broadinstitute.sting.gatk.refdata.tracks.builders.RMDTrackBuilder;
import org.broadinstitute.sting.gatk.refdata.utils.LocationAwareSeekableRODIterator;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.GenomeLocParser;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.testng.Assert.assertTrue;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.io.File;
import java.io.FileNotFoundException;
import static org.junit.Assert.assertTrue;
import net.sf.picard.reference.IndexedFastaSequenceFile;
/**
* User: hanna
@ -40,17 +40,21 @@ public class ReferenceOrderedDataPoolUnitTest extends BaseTest {
private RMDTrack rod = null;
private final GenomeLoc testSite1 = GenomeLocParser.createGenomeLoc("chrM",10);
private final GenomeLoc testSite2 = GenomeLocParser.createGenomeLoc("chrM",20);
private final GenomeLoc testSite3 = GenomeLocParser.createGenomeLoc("chrM",30);
private GenomeLoc testSite1;
private GenomeLoc testSite2;
private GenomeLoc testSite3;
@BeforeClass
public static void init() throws FileNotFoundException {
public void init() throws FileNotFoundException {
File sequenceFile = new File(hg18Reference);
GenomeLocParser.setupRefContigOrdering(new IndexedFastaSequenceFile(sequenceFile));
testSite1 = GenomeLocParser.createGenomeLoc("chrM",10);
testSite2 = GenomeLocParser.createGenomeLoc("chrM",20);
testSite3 = GenomeLocParser.createGenomeLoc("chrM",30);
}
@Before
@BeforeMethod
public void setUp() {
File file = new File(testDir + "TabularDataTest.dat");
RMDTrackBuilder builder = new RMDTrackBuilder();
@ -62,8 +66,8 @@ public class ReferenceOrderedDataPoolUnitTest extends BaseTest {
ResourcePool iteratorPool = new ReferenceOrderedDataPool(rod, false);
LocationAwareSeekableRODIterator iterator = (LocationAwareSeekableRODIterator)iteratorPool.iterator( new MappedStreamSegment(testSite1) );
Assert.assertEquals("Number of iterators in the pool is incorrect", 1, iteratorPool.numIterators());
Assert.assertEquals("Number of available iterators in the pool is incorrect", 0, iteratorPool.numAvailableIterators());
Assert.assertEquals(iteratorPool.numIterators(), 1, "Number of iterators in the pool is incorrect");
Assert.assertEquals(iteratorPool.numAvailableIterators(), 0, "Number of available iterators in the pool is incorrect");
TableFeature datum = (TableFeature)iterator.next().get(0).getUnderlyingObject();
@ -74,8 +78,8 @@ public class ReferenceOrderedDataPoolUnitTest extends BaseTest {
iteratorPool.release(iterator);
Assert.assertEquals("Number of iterators in the pool is incorrect", 1, iteratorPool.numIterators());
Assert.assertEquals("Number of available iterators in the pool is incorrect", 1, iteratorPool.numAvailableIterators());
Assert.assertEquals(iteratorPool.numIterators(), 1, "Number of iterators in the pool is incorrect");
Assert.assertEquals(iteratorPool.numAvailableIterators(), 1, "Number of available iterators in the pool is incorrect");
}
@Test
@ -86,8 +90,8 @@ public class ReferenceOrderedDataPoolUnitTest extends BaseTest {
// Create a new iterator at position 2.
LocationAwareSeekableRODIterator iterator2 = iteratorPool.iterator( new MappedStreamSegment(testSite2) );
Assert.assertEquals("Number of iterators in the pool is incorrect", 2, iteratorPool.numIterators());
Assert.assertEquals("Number of available iterators in the pool is incorrect", 0, iteratorPool.numAvailableIterators());
Assert.assertEquals(iteratorPool.numIterators(), 2, "Number of iterators in the pool is incorrect");
Assert.assertEquals(iteratorPool.numAvailableIterators(), 0, "Number of available iterators in the pool is incorrect");
// Test out-of-order access: first iterator2, then iterator1.
// Ugh...first call to a region needs to be a seek.
@ -119,13 +123,13 @@ public class ReferenceOrderedDataPoolUnitTest extends BaseTest {
// Cleanup, and make sure the number of iterators dies appropriately.
iteratorPool.release(iterator1);
Assert.assertEquals("Number of iterators in the pool is incorrect", 2, iteratorPool.numIterators());
Assert.assertEquals("Number of available iterators in the pool is incorrect", 1, iteratorPool.numAvailableIterators());
Assert.assertEquals(iteratorPool.numIterators(), 2, "Number of iterators in the pool is incorrect");
Assert.assertEquals(iteratorPool.numAvailableIterators(), 1, "Number of available iterators in the pool is incorrect");
iteratorPool.release(iterator2);
Assert.assertEquals("Number of iterators in the pool is incorrect", 2, iteratorPool.numIterators());
Assert.assertEquals("Number of available iterators in the pool is incorrect", 2, iteratorPool.numAvailableIterators());
Assert.assertEquals(iteratorPool.numIterators(), 2, "Number of iterators in the pool is incorrect");
Assert.assertEquals(iteratorPool.numAvailableIterators(), 2, "Number of available iterators in the pool is incorrect");
}
@Test
@ -133,8 +137,8 @@ public class ReferenceOrderedDataPoolUnitTest extends BaseTest {
ReferenceOrderedDataPool iteratorPool = new ReferenceOrderedDataPool(rod, false);
LocationAwareSeekableRODIterator iterator = iteratorPool.iterator( new MappedStreamSegment(testSite1) );
Assert.assertEquals("Number of iterators in the pool is incorrect", 1, iteratorPool.numIterators());
Assert.assertEquals("Number of available iterators in the pool is incorrect", 0, iteratorPool.numAvailableIterators());
Assert.assertEquals(iteratorPool.numIterators(), 1, "Number of iterators in the pool is incorrect");
Assert.assertEquals(iteratorPool.numAvailableIterators(), 0, "Number of available iterators in the pool is incorrect");
TableFeature datum = (TableFeature)iterator.next().get(0).getUnderlyingObject();
assertTrue(datum.getLocation().equals(testSite1));
@ -148,8 +152,8 @@ public class ReferenceOrderedDataPoolUnitTest extends BaseTest {
iterator = iteratorPool.iterator( new MappedStreamSegment(testSite3) );
// Make sure that the previously acquired iterator was reused.
Assert.assertEquals("Number of iterators in the pool is incorrect", 1, iteratorPool.numIterators());
Assert.assertEquals("Number of available iterators in the pool is incorrect", 0, iteratorPool.numAvailableIterators());
Assert.assertEquals(iteratorPool.numIterators(), 1, "Number of iterators in the pool is incorrect");
Assert.assertEquals(iteratorPool.numAvailableIterators(), 0, "Number of available iterators in the pool is incorrect");
datum = (TableFeature)iterator.seekForward(testSite3).get(0).getUnderlyingObject();
assertTrue(datum.getLocation().equals(testSite3));
@ -159,8 +163,8 @@ public class ReferenceOrderedDataPoolUnitTest extends BaseTest {
iteratorPool.release(iterator);
Assert.assertEquals("Number of iterators in the pool is incorrect", 1, iteratorPool.numIterators());
Assert.assertEquals("Number of available iterators in the pool is incorrect", 1, iteratorPool.numAvailableIterators());
Assert.assertEquals(iteratorPool.numIterators(), 1, "Number of iterators in the pool is incorrect");
Assert.assertEquals(iteratorPool.numAvailableIterators(), 1, "Number of available iterators in the pool is incorrect");
}
@Test
@ -168,8 +172,8 @@ public class ReferenceOrderedDataPoolUnitTest extends BaseTest {
ReferenceOrderedDataPool iteratorPool = new ReferenceOrderedDataPool(rod, false);
LocationAwareSeekableRODIterator iterator = iteratorPool.iterator( new MappedStreamSegment(testSite3) );
Assert.assertEquals("Number of iterators in the pool is incorrect", 1, iteratorPool.numIterators());
Assert.assertEquals("Number of available iterators in the pool is incorrect", 0, iteratorPool.numAvailableIterators());
Assert.assertEquals(iteratorPool.numIterators(), 1, "Number of iterators in the pool is incorrect");
Assert.assertEquals(iteratorPool.numAvailableIterators(), 0, "Number of available iterators in the pool is incorrect");
TableFeature datum = (TableFeature)iterator.seekForward(testSite3).get(0).getUnderlyingObject();
assertTrue(datum.getLocation().equals(testSite3));
@ -183,8 +187,8 @@ public class ReferenceOrderedDataPoolUnitTest extends BaseTest {
iterator = iteratorPool.iterator(new MappedStreamSegment(testSite1) );
// Make sure that the previously acquired iterator was reused.
Assert.assertEquals("Number of iterators in the pool is incorrect", 2, iteratorPool.numIterators());
Assert.assertEquals("Number of available iterators in the pool is incorrect", 1, iteratorPool.numAvailableIterators());
Assert.assertEquals(iteratorPool.numIterators(), 2, "Number of iterators in the pool is incorrect");
Assert.assertEquals(iteratorPool.numAvailableIterators(), 1, "Number of available iterators in the pool is incorrect");
datum = (TableFeature)iterator.next().get(0).getUnderlyingObject();
assertTrue(datum.getLocation().equals(testSite1));
@ -194,8 +198,8 @@ public class ReferenceOrderedDataPoolUnitTest extends BaseTest {
iteratorPool.release(iterator);
Assert.assertEquals("Number of iterators in the pool is incorrect", 2, iteratorPool.numIterators());
Assert.assertEquals("Number of available iterators in the pool is incorrect", 2, iteratorPool.numAvailableIterators());
Assert.assertEquals(iteratorPool.numIterators(), 2, "Number of iterators in the pool is incorrect");
Assert.assertEquals(iteratorPool.numAvailableIterators(), 2, "Number of available iterators in the pool is incorrect");
}
}

View File

@ -1,6 +1,6 @@
package org.broadinstitute.sting.gatk.datasources.simpleDataSources;
import static junit.framework.Assert.fail;
import static org.testng.Assert.fail;
import net.sf.picard.reference.IndexedFastaSequenceFile;
import net.sf.samtools.SAMRecord;
import org.broadinstitute.sting.BaseTest;
@ -8,13 +8,13 @@ import org.broadinstitute.sting.gatk.datasources.shards.Shard;
import org.broadinstitute.sting.gatk.datasources.shards.ShardStrategy;
import org.broadinstitute.sting.gatk.datasources.shards.ShardStrategyFactory;
import org.broadinstitute.sting.gatk.iterators.StingSAMIterator;
import org.broadinstitute.sting.gatk.ReadProperties;
import org.broadinstitute.sting.utils.GenomeLocParser;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.exceptions.UserException;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.io.File;
import java.io.FileNotFoundException;
@ -58,7 +58,7 @@ public class SAMBAMDataSourceUnitTest extends BaseTest {
* <p/>
* Called before every test case method.
*/
@Before
@BeforeMethod
public void doForEachTest() throws FileNotFoundException {
readers = new ArrayList<SAMReaderID>();
@ -72,7 +72,7 @@ public class SAMBAMDataSourceUnitTest extends BaseTest {
* <p/>
* Called after every test case method.
*/
@After
@AfterMethod
public void undoForEachTest() {
seq = null;
readers.clear();

View File

@ -1,10 +1,11 @@
package org.broadinstitute.sting.gatk.executive;
import org.junit.Assert;
import org.junit.Test;
import org.junit.Before;
import org.junit.After;
import org.junit.Ignore;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeMethod;
import org.broadinstitute.sting.BaseTest;
import java.util.concurrent.Callable;
@ -42,12 +43,12 @@ public class ReduceTreeUnitTest extends BaseTest implements ReduceTree.TreeReduc
*/
private List<List<Integer>> reduces = new ArrayList<List<Integer>>();
@Before
@BeforeMethod
public void createTree() {
reduceTree = new ReduceTree( this );
}
@After
@AfterMethod
public void destroyTree() {
reduceTree = null;
reduces.clear();
@ -57,7 +58,7 @@ public class ReduceTreeUnitTest extends BaseTest implements ReduceTree.TreeReduc
public void testNoValueReduce()
throws InterruptedException, ExecutionException {
reduceTree.complete();
Assert.assertEquals("Single-value reduce failed", null, reduceTree.getResult());
Assert.assertEquals(reduceTree.getResult(), null, "Single-value reduce failed");
}
@Test
@ -65,10 +66,10 @@ public class ReduceTreeUnitTest extends BaseTest implements ReduceTree.TreeReduc
throws InterruptedException, ExecutionException {
reduceTree.addEntry( getReduceTestEntry(1) );
reduceTree.complete();
Assert.assertEquals("Single-value reduce failed", 1, reduceTree.getResult().get());
Assert.assertEquals(reduceTree.getResult().get(), 1, "Single-value reduce failed");
}
@Test(expected=IllegalStateException.class)
@Test(expectedExceptions=IllegalStateException.class)
public void testIncompleteReduce()
throws InterruptedException, ExecutionException {
reduceTree.addEntry( getReduceTestEntry(1) );
@ -87,11 +88,11 @@ public class ReduceTreeUnitTest extends BaseTest implements ReduceTree.TreeReduc
expected.add( 2 );
// Test the result
Assert.assertEquals("Dual-value reduce failed", expected, reduceTree.getResult().get());
Assert.assertEquals(reduceTree.getResult().get(), expected, "Dual-value reduce failed");
// Test the intermediate steps
Assert.assertEquals("Size of incoming tree reduces incorrect", 1, reduces.size() );
Assert.assertEquals("Incoming tree reduce incorrect", expected, reduces.get(0) );
Assert.assertEquals(reduces.size(), 1, "Size of incoming tree reduces incorrect");
Assert.assertEquals(reduces.get(0), expected, "Incoming tree reduce incorrect");
}
@Test
@ -107,26 +108,26 @@ public class ReduceTreeUnitTest extends BaseTest implements ReduceTree.TreeReduc
reduceTree.addEntry( getReduceTestEntry(1) );
Assert.assertEquals("Reduce queue should be empty after entering a single element", 0, reduces.size());
Assert.assertEquals(reduces.size(), 0, "Reduce queue should be empty after entering a single element");
reduceTree.addEntry( getReduceTestEntry(2) );
Assert.assertEquals("Reduce queue should have one element after two entries", 1, reduces.size());
Assert.assertEquals("Reduce queue element is incorrect after two entries", firstExpected, reduces.get(0));
Assert.assertEquals(reduces.size(), 1, "Reduce queue should have one element after two entries");
Assert.assertEquals(reduces.get(0), firstExpected, "Reduce queue element is incorrect after two entries");
reduceTree.addEntry( getReduceTestEntry(3) );
Assert.assertEquals("Reduce queue should have one element after three entries", 1, reduces.size());
Assert.assertEquals("Reduce queue element is incorrect after three entries", firstExpected, reduces.get(0));
Assert.assertEquals(reduces.size(), 1, "Reduce queue should have one element after three entries");
Assert.assertEquals(reduces.get(0), firstExpected, "Reduce queue element is incorrect after three entries");
reduceTree.complete();
// Test the result
Assert.assertEquals("Three value reduce failed", finalExpected, reduceTree.getResult().get());
Assert.assertEquals(reduceTree.getResult().get(), finalExpected, "Three value reduce failed");
Assert.assertEquals("Reduce queue should have two elements after three entries (complete)", 2, reduces.size());
Assert.assertEquals("Reduce queue element is incorrect after three entries", firstExpected, reduces.get(0));
Assert.assertEquals("Reduce queue element is incorrect after three entries", finalExpected, reduces.get(1));
Assert.assertEquals(reduces.size(), 2, "Reduce queue should have two elements after three entries (complete)");
Assert.assertEquals(reduces.get(0), firstExpected, "Reduce queue element is incorrect after three entries");
Assert.assertEquals(reduces.get(1), finalExpected, "Reduce queue element is incorrect after three entries");
}
@Test
@ -146,35 +147,35 @@ public class ReduceTreeUnitTest extends BaseTest implements ReduceTree.TreeReduc
reduceTree.addEntry( getReduceTestEntry(1) );
Assert.assertEquals("Reduce queue should be empty after entering a single element", 0, reduces.size());
Assert.assertEquals(reduces.size(), 0, "Reduce queue should be empty after entering a single element");
reduceTree.addEntry( getReduceTestEntry(2) );
Assert.assertEquals("Reduce queue should have one element after two entries", 1, reduces.size());
Assert.assertEquals("Reduce queue element is incorrect after two entries", lhsExpected, reduces.get(0));
Assert.assertEquals(reduces.size(), 1, "Reduce queue should have one element after two entries");
Assert.assertEquals(reduces.get(0), lhsExpected, "Reduce queue element is incorrect after two entries");
reduceTree.addEntry( getReduceTestEntry(3) );
Assert.assertEquals("Reduce queue should have one element after three entries", 1, reduces.size());
Assert.assertEquals("Reduce queue element is incorrect after three entries", lhsExpected, reduces.get(0));
Assert.assertEquals(reduces.size(), 1, "Reduce queue should have one element after three entries");
Assert.assertEquals(reduces.get(0), lhsExpected, "Reduce queue element is incorrect after three entries");
reduceTree.addEntry( getReduceTestEntry(4) );
Assert.assertEquals("Reduce queue should have three elements after four entries", 3, reduces.size());
Assert.assertEquals("Reduce queue element 0 is incorrect after three entries", lhsExpected, reduces.get(0));
Assert.assertEquals("Reduce queue element 1 is incorrect after three entries", rhsExpected, reduces.get(1));
Assert.assertEquals("Reduce queue element 2 is incorrect after three entries", finalExpected, reduces.get(2));
Assert.assertEquals(reduces.size(), 3, "Reduce queue should have three elements after four entries");
Assert.assertEquals(reduces.get(0), lhsExpected, "Reduce queue element 0 is incorrect after three entries");
Assert.assertEquals(reduces.get(1), rhsExpected, "Reduce queue element 1 is incorrect after three entries");
Assert.assertEquals(reduces.get(2), finalExpected, "Reduce queue element 2 is incorrect after three entries");
reduceTree.complete();
// Test the result
Assert.assertEquals("Four-valued reduce failed",finalExpected,reduceTree.getResult().get());
Assert.assertEquals(reduceTree.getResult().get(), finalExpected, "Four-valued reduce failed");
// Test the working tree
Assert.assertEquals("Didn't see correct number of reduces", 3, reduces.size());
Assert.assertEquals("lhs of four value reduce failed", lhsExpected, reduces.get(0));
Assert.assertEquals("rhs of four value reduce failed", rhsExpected, reduces.get(1));
Assert.assertEquals("final value four value reduce failed", finalExpected, reduces.get(2));
Assert.assertEquals(reduces.size(), 3, "Didn't see correct number of reduces");
Assert.assertEquals(reduces.get(0), lhsExpected, "lhs of four value reduce failed");
Assert.assertEquals(reduces.get(1), rhsExpected, "rhs of four value reduce failed");
Assert.assertEquals(reduces.get(2), finalExpected, "final value four value reduce failed");
}
@ -214,7 +215,6 @@ public class ReduceTreeUnitTest extends BaseTest implements ReduceTree.TreeReduc
return getReduceTestEntry( reduce );
}
@Ignore
private class ReduceTestEntry implements Callable {
private Object data;

View File

@ -1,12 +1,13 @@
package org.broadinstitute.sting.gatk.filters;
import org.testng.Assert;
import org.broadinstitute.sting.BaseTest;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import org.broadinstitute.sting.utils.sam.ArtificialSAMUtils;
import org.broadinstitute.sting.utils.GenomeLocParser;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import net.sf.samtools.SAMFileHeader;
import net.sf.samtools.SAMRecord;
import net.sf.samtools.SAMReadGroupRecord;
@ -24,7 +25,7 @@ public class ReadGroupBlackListFilterUnitTest extends BaseTest {
private static SAMFileHeader header;
@BeforeClass
public static void beforeClass() {
public void beforeClass() {
header = ArtificialSAMUtils.createArtificialSamHeader(1, 1, 1000);
List<String> readGroupIDs = new ArrayList<String>();
@ -46,18 +47,18 @@ public class ReadGroupBlackListFilterUnitTest extends BaseTest {
GenomeLocParser.setupRefContigOrdering(header.getSequenceDictionary());
}
@Test(expected = ReviewedStingException.class)
@Test(expectedExceptions=ReviewedStingException.class)
public void testBadFilter() {
List<String> badFilters = Collections.singletonList("bad");
new ReadGroupBlackListFilter(badFilters);
}
@Test(expected = ReviewedStingException.class)
@Test(expectedExceptions=ReviewedStingException.class)
public void testBadFilterTag() {
List<String> badFilters = Collections.singletonList("bad:filter");
new ReadGroupBlackListFilter(badFilters);
}
@Test(expected = ReviewedStingException.class)
@Test(expectedExceptions=ReviewedStingException.class)
public void testBadFilterFile() {
List<String> badFilters = Collections.singletonList("/foo/bar/rgbl.txt");
new ReadGroupBlackListFilter(badFilters);
@ -131,8 +132,8 @@ public class ReadGroupBlackListFilterUnitTest extends BaseTest {
int filteredExpected = recordsPerGroup * 2;
int unfilteredExpected = recordsPerGroup * (READ_GROUP_COUNT - 2);
Assert.assertEquals("Filtered", filteredExpected, filtered);
Assert.assertEquals("Uniltered", unfilteredExpected, unfiltered);
Assert.assertEquals(filtered, filteredExpected, "Filtered");
Assert.assertEquals(unfiltered, unfilteredExpected, "Uniltered");
}
@Test
@ -170,8 +171,8 @@ public class ReadGroupBlackListFilterUnitTest extends BaseTest {
int filteredExpected = 6;
int unfilteredExpected = 9;
Assert.assertEquals("Filtered", filteredExpected, filtered);
Assert.assertEquals("Uniltered", unfilteredExpected, unfiltered);
Assert.assertEquals(filtered, filteredExpected, "Filtered");
Assert.assertEquals(unfiltered, unfilteredExpected, "Uniltered");
}
@Test
@ -209,8 +210,8 @@ public class ReadGroupBlackListFilterUnitTest extends BaseTest {
int filteredExpected = recordsPerGroup * 2;
int unfilteredExpected = recordsPerGroup * (READ_GROUP_COUNT - 2);
Assert.assertEquals("Filtered", filteredExpected, filtered);
Assert.assertEquals("Uniltered", unfilteredExpected, unfiltered);
Assert.assertEquals(filtered, filteredExpected, "Filtered");
Assert.assertEquals(unfiltered, unfilteredExpected, "Uniltered");
}
@Test
@ -248,7 +249,7 @@ public class ReadGroupBlackListFilterUnitTest extends BaseTest {
int filteredExpected = recordsPerGroup * 2;
int unfilteredExpected = recordsPerGroup * (READ_GROUP_COUNT - 2);
Assert.assertEquals("Filtered", filteredExpected, filtered);
Assert.assertEquals("Uniltered", unfilteredExpected, unfiltered);
Assert.assertEquals(filtered, filteredExpected, "Filtered");
Assert.assertEquals(unfiltered, unfilteredExpected, "Uniltered");
}
}

View File

@ -1,19 +1,20 @@
package org.broadinstitute.sting.gatk.iterators;
import static junit.framework.Assert.fail;
import static org.testng.Assert.fail;
import net.sf.samtools.SAMFileHeader;
import net.sf.samtools.SAMRecord;
import net.sf.picard.reference.ReferenceSequenceFile;
import net.sf.picard.reference.IndexedFastaSequenceFile;
import org.broadinstitute.sting.BaseTest;
import org.broadinstitute.sting.gatk.ReadProperties;
import org.testng.Assert;
import org.broadinstitute.sting.utils.GenomeLocParser;
import org.broadinstitute.sting.utils.sam.ArtificialSAMUtils;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.io.File;
import java.io.FileNotFoundException;
@ -68,7 +69,7 @@ public class BoundedReadIteratorUnitTest extends BaseTest {
* <p/>
* Called before every test case method.
*/
@Before
@BeforeMethod
public void doForEachTest() throws FileNotFoundException {
fl = new ArrayList<File>();
@ -92,7 +93,7 @@ public class BoundedReadIteratorUnitTest extends BaseTest {
count++;
}
Assert.assertEquals(expected,count);
Assert.assertEquals(count, expected);
}
}
@ -120,4 +121,4 @@ class testIterator implements StingSAMIterator {
public Iterator<SAMRecord> iterator() {
return this;
}
}
}

View File

@ -1,11 +1,11 @@
package org.broadinstitute.sting.gatk.iterators;
import junit.framework.Assert;
import net.sf.picard.filter.SamRecordFilter;
import net.sf.samtools.SAMFileHeader;
import net.sf.samtools.SAMFileReader;
import net.sf.samtools.SAMRecord;
import net.sf.samtools.util.CloseableIterator;
import org.testng.Assert;
import org.broadinstitute.sting.BaseTest;
import org.broadinstitute.sting.gatk.ReadProperties;
import org.broadinstitute.sting.gatk.arguments.ValidationExclusion;
@ -15,8 +15,8 @@ import org.broadinstitute.sting.utils.GenomeLocParser;
import org.broadinstitute.sting.utils.pileup.ReadBackedExtendedEventPileup;
import org.broadinstitute.sting.utils.classloader.JVMUtils;
import org.broadinstitute.sting.utils.sam.ArtificialSAMUtils;
import org.junit.BeforeClass;
import org.junit.Test;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.util.*;
@ -30,7 +30,7 @@ public class LocusIteratorByStateUnitTest extends BaseTest {
private LocusIteratorByState li;
@BeforeClass
public static void beforeClass() {
public void beforeClass() {
header = ArtificialSAMUtils.createArtificialSamHeader(1, 1, 1000);
GenomeLocParser.setupRefContigOrdering(header.getSequenceDictionary());
}
@ -70,13 +70,13 @@ public class LocusIteratorByStateUnitTest extends BaseTest {
continue;
ReadBackedExtendedEventPileup pileup = context.getExtendedEventPileup().getBaseFilteredPileup(10);
Assert.assertEquals("Extended event pileup at wrong location",5,pileup.getLocation().getStart());
Assert.assertEquals("Pileup size is incorrect",3,pileup.size());
Assert.assertEquals(pileup.getLocation().getStart(), 5, "Extended event pileup at wrong location");
Assert.assertEquals(pileup.size(), 3, "Pileup size is incorrect");
foundExtendedEventPileup = true;
}
Assert.assertTrue("Extended event pileup not found",foundExtendedEventPileup);
Assert.assertTrue(foundExtendedEventPileup,"Extended event pileup not found");
}
/**
@ -121,15 +121,15 @@ public class LocusIteratorByStateUnitTest extends BaseTest {
if(!context.hasExtendedEventPileup())
continue;
Assert.assertEquals("Extended event pileup at wrong location",10,context.getLocation().getStart());
Assert.assertEquals("Pileup size is incorrect",2,context.size());
Assert.assertEquals("Read in pileup is incorrect",during,context.getExtendedEventPileup().getReads().get(0));
Assert.assertEquals("Read in pileup is incorrect",after,context.getExtendedEventPileup().getReads().get(1));
Assert.assertEquals(context.getLocation().getStart(), 10, "Extended event pileup at wrong location");
Assert.assertEquals(context.size(), 2, "Pileup size is incorrect");
Assert.assertEquals(context.getExtendedEventPileup().getReads().get(0), during, "Read in pileup is incorrect");
Assert.assertEquals(context.getExtendedEventPileup().getReads().get(1), after, "Read in pileup is incorrect");
foundExtendedEventPileup = true;
}
Assert.assertTrue("Extended event pileup not found",foundExtendedEventPileup);
Assert.assertTrue(foundExtendedEventPileup,"Extended event pileup not found");
}
private static ReadProperties createTestReadProperties() {
@ -174,4 +174,4 @@ class FakeCloseableIterator<T> implements CloseableIterator<T> {
public void remove() {
throw new UnsupportedOperationException("Don't remove!");
}
}
}

View File

@ -3,8 +3,8 @@ package org.broadinstitute.sting.gatk.iterators;
import net.sf.samtools.SAMRecord;
import net.sf.samtools.util.CloseableIterator;
import org.broadinstitute.sting.BaseTest;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import static org.testng.Assert.assertEquals;
import org.testng.annotations.Test;
import java.util.Iterator;
@ -105,9 +105,9 @@ public class StingSAMIteratorAdapterUnitTest extends BaseTest {
//logger.warn("cnt = " + countCheck);
}
assertEquals(COUNT, countCheck);
assertEquals(countCheck, COUNT);
assertEquals(COUNT, countCheck);
assertEquals(countCheck, COUNT);
}
@Test
@ -124,7 +124,7 @@ public class StingSAMIteratorAdapterUnitTest extends BaseTest {
++countCheck;
}
assertEquals(COUNT, countCheck);
assertEquals(countCheck, COUNT);
}
@Test
@ -142,10 +142,10 @@ public class StingSAMIteratorAdapterUnitTest extends BaseTest {
++countCheck;
}
assertEquals(COUNT, countCheck);
assertEquals(countCheck, COUNT);
// check to see that the count get's set to -1
samIt.close();
assertEquals(-1, it.count);
assertEquals(it.count, -1);
}
}

View File

@ -25,16 +25,18 @@ package org.broadinstitute.sting.gatk.refdata;
import net.sf.samtools.SAMFileHeader;
import net.sf.samtools.SAMRecord;
import org.testng.Assert;
import org.broadinstitute.sting.BaseTest;
import org.broadinstitute.sting.gatk.datasources.providers.RODMetaDataContainer;
import org.broadinstitute.sting.gatk.refdata.utils.GATKFeature;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.GenomeLocParser;
import org.broadinstitute.sting.utils.sam.ArtificialSAMUtils;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.util.*;
@ -55,12 +57,12 @@ public class ReadMetaDataTrackerUnitTest extends BaseTest {
private Set<String> nameSet;
@BeforeClass
public static void beforeClass() {
public void beforeClass() {
header = ArtificialSAMUtils.createArtificialSamHeader((endingChr - startingChr) + 1, startingChr, readCount + DEFAULT_READ_LENGTH);
GenomeLocParser.setupRefContigOrdering(header.getSequenceDictionary());
}
@Before
@BeforeMethod
public void beforeEach() {
nameSet = new TreeSet<String>();
nameSet.add("default");
@ -75,9 +77,9 @@ public class ReadMetaDataTrackerUnitTest extends BaseTest {
int count = 0;
for (Long x : tracker.getReadOffsetMapping().keySet()) {
count++;
Assert.assertEquals(2, tracker.getReadOffsetMapping().get(x).size());
Assert.assertEquals(tracker.getReadOffsetMapping().get(x).size(), 2);
}
Assert.assertEquals(10, count);
Assert.assertEquals(count, 10);
}
@Test
@ -89,9 +91,9 @@ public class ReadMetaDataTrackerUnitTest extends BaseTest {
int count = 0;
for (Long x : tracker.getReadOffsetMapping().keySet()) {
count++;
Assert.assertEquals(1, tracker.getReadOffsetMapping().get(x).size());
Assert.assertEquals(tracker.getReadOffsetMapping().get(x).size(), 1);
}
Assert.assertEquals(10, count);
Assert.assertEquals(count, 10);
}
@Test
@ -104,9 +106,9 @@ public class ReadMetaDataTrackerUnitTest extends BaseTest {
Map<Long, Collection<GATKFeature>> map = tracker.getReadOffsetMapping("default");
for (Long x : map.keySet()) {
count++;
Assert.assertEquals(1, map.get(x).size());
Assert.assertEquals(map.get(x).size(), 1);
}
Assert.assertEquals(10, count);
Assert.assertEquals(count, 10);
}
@Test
@ -118,9 +120,9 @@ public class ReadMetaDataTrackerUnitTest extends BaseTest {
Map<Long, Collection<GATKFeature>> map = tracker.getReadOffsetMapping(FakeRODatum.class);
for (Long x : map.keySet()) {
count++;
Assert.assertEquals(2, map.get(x).size());
Assert.assertEquals(map.get(x).size(), 2);
}
Assert.assertEquals(10, count);
Assert.assertEquals(count, 10);
}
// @Test this test can be uncommented to determine the speed impacts of any changes to the RODs for reads system
@ -137,9 +139,9 @@ public class ReadMetaDataTrackerUnitTest extends BaseTest {
Map<Long, Collection<GATKFeature>> map = tracker.getReadOffsetMapping(FakeRODatum.class);
for (Long x : map.keySet()) {
count++;
Assert.assertEquals(y + 2, map.get(x).size());
Assert.assertEquals(map.get(x).size(), y + 2);
}
Assert.assertEquals(10, count);
Assert.assertEquals(count, 10);
}
System.err.println(y + " = " + (System.currentTimeMillis() - firstTime));
}
@ -156,9 +158,9 @@ public class ReadMetaDataTrackerUnitTest extends BaseTest {
Map<Long, Collection<GATKFeature>> map = tracker.getReadOffsetMapping(Fake2RODatum.class);
for (long x : map.keySet()) {
count++;
Assert.assertEquals(1, map.get(x).size());
Assert.assertEquals(map.get(x).size(), 1);
}
Assert.assertEquals(10, count);
Assert.assertEquals(count, 10);
}
@Test
@ -169,9 +171,9 @@ public class ReadMetaDataTrackerUnitTest extends BaseTest {
int count = 0;
for (Long x : tracker.getReadOffsetMapping().keySet()) {
count++;
Assert.assertEquals(1, tracker.getReadOffsetMapping().get(x).size());
Assert.assertEquals(tracker.getReadOffsetMapping().get(x).size(), 1);
}
Assert.assertEquals(2, count);
Assert.assertEquals(count, 2);
}
@Test
@ -182,9 +184,9 @@ public class ReadMetaDataTrackerUnitTest extends BaseTest {
int count = 0;
for (Long x : tracker.getContigOffsetMapping().keySet()) {
count++;
Assert.assertEquals(1, tracker.getContigOffsetMapping().get(x).size());
Assert.assertEquals(tracker.getContigOffsetMapping().get(x).size(), 1);
}
Assert.assertEquals(10, count);
Assert.assertEquals(count, 10);
}
@ -269,4 +271,4 @@ public class ReadMetaDataTrackerUnitTest extends BaseTest {
return (int)this.location.getStop();
}
}
}
}

View File

@ -1,8 +1,9 @@
package org.broadinstitute.sting.gatk.refdata;
import org.testng.Assert;
import org.broadinstitute.sting.BaseTest;
import org.junit.Assert;
import org.junit.Test;
import org.testng.annotations.Test;
import java.util.ArrayList;
import java.util.List;
@ -23,7 +24,7 @@ public class ReferenceOrderedDataUnitTest extends BaseTest {
String file = validationDataLocation + "testRODFileImpl.csv";
List<String> lst = new ArrayList<String>();
ReferenceOrderedData.extractRodsFromFile(lst,file);
Assert.assertEquals(6,lst.size());
Assert.assertEquals(lst.size(), 6);
int index = 0;
for (String entry: lst) {
String first = entry.subSequence(0,entry.indexOf(",")).toString();
@ -37,7 +38,7 @@ public class ReferenceOrderedDataUnitTest extends BaseTest {
List<String> lst = new ArrayList<String>();
ReferenceOrderedData.extractRodsFromFile(lst,file);
ReferenceOrderedData.extractRodsFromFile(lst,file2);
Assert.assertEquals(12,lst.size());
Assert.assertEquals(lst.size(), 12);
int index = 0;
for (String entry: lst) {
String first = entry.subSequence(0,entry.indexOf(",")).toString();

View File

@ -26,16 +26,17 @@ package org.broadinstitute.sting.gatk.refdata.tracks.builders;
import net.sf.picard.reference.IndexedFastaSequenceFile;
import net.sf.samtools.SAMSequenceDictionary;
import net.sf.samtools.SAMSequenceRecord;
import org.broad.tribble.Tribble;
import org.broad.tribble.index.Index;
import org.broad.tribble.vcf.VCFCodec;
import org.testng.Assert;
import org.broadinstitute.sting.BaseTest;
import org.broadinstitute.sting.utils.GenomeLocParser;
import org.broadinstitute.sting.utils.file.FSLockWithShared;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.io.*;
import java.nio.channels.FileChannel;
@ -53,7 +54,7 @@ public class RMDTrackBuilderUnitTest extends BaseTest {
private RMDTrackBuilder builder;
private IndexedFastaSequenceFile seq;
@Before
@BeforeMethod
public void setup() {
builder = new RMDTrackBuilder();
seq = new IndexedFastaSequenceFile(new File(b36KGReference));
@ -160,7 +161,7 @@ public class RMDTrackBuilderUnitTest extends BaseTest {
}
// make sure that we removed and updated the index
Assert.assertTrue("Fail: index file was modified", Tribble.indexFile(vcfFile).lastModified() == indexTimeStamp);
Assert.assertTrue(Tribble.indexFile(vcfFile).lastModified() == indexTimeStamp,"Fail: index file was modified");
}
/**

View File

@ -1,14 +1,16 @@
package org.broadinstitute.sting.gatk.refdata.utils;
import net.sf.samtools.SAMFileHeader;
import org.testng.Assert;
import org.broadinstitute.sting.BaseTest;
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedDatum;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.GenomeLocParser;
import org.broadinstitute.sting.utils.sam.ArtificialSAMUtils;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.io.File;
import java.io.FileNotFoundException;
@ -31,7 +33,7 @@ public class FlashBackIteratorUnitTest extends BaseTest {
private static final int STARTING_CHROMOSOME = 1;
private static final int CHROMOSOME_SIZE = 1000;
@Before
@BeforeMethod
public void setup() {
GenomeLocParser.setupRefContigOrdering(header.getSequenceDictionary());
}
@ -86,7 +88,7 @@ public class FlashBackIteratorUnitTest extends BaseTest {
count++;
iter.next();
}
Assert.assertEquals(10, count);
Assert.assertEquals(count, 10);
}
@ -133,7 +135,7 @@ public class FlashBackIteratorUnitTest extends BaseTest {
count++;
iter.next();
}
Assert.assertEquals(6, count); // chr1:5, 6, 7, 8, 9, and 10
Assert.assertEquals(count, 6); // chr1:5, 6, 7, 8, 9, and 10
}
}
@ -309,4 +311,4 @@ class FakeRODRecordList extends AbstractList<GATKFeature> implements RODRecordLi
public int compareTo(RODRecordList rodRecordList) {
return this.list.get(0).getLocation().compareTo(rodRecordList.getLocation());
}
}
}

View File

@ -27,12 +27,14 @@ package org.broadinstitute.sting.gatk.traversals;
import net.sf.samtools.SAMFileHeader;
import net.sf.samtools.SAMRecord;
import org.testng.Assert;
import org.broadinstitute.sting.BaseTest;
import org.broadinstitute.sting.utils.GenomeLocParser;
import org.broadinstitute.sting.utils.sam.ArtificialSAMUtils;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.util.ArrayList;
import java.util.List;
@ -52,7 +54,7 @@ public class TraverseDuplicatesUnitTest extends BaseTest {
private SAMFileHeader header;
@Before
@BeforeMethod
public void doBefore() {
header = ArtificialSAMUtils.createArtificialSamHeader(1, 1, 1000);
GenomeLocParser.setupRefContigOrdering(header.getSequenceDictionary());
@ -67,8 +69,8 @@ public class TraverseDuplicatesUnitTest extends BaseTest {
list.add(read);
}
Set<List<SAMRecord>> myPairings = obj.uniqueReadSets(list);
Assert.assertEquals(1, myPairings.size());
Assert.assertEquals(10, myPairings.iterator().next().size()); // dup's
Assert.assertEquals(myPairings.size(), 1);
Assert.assertEquals(myPairings.iterator().next().size(), 10); // dup's
}
@Test
@ -81,7 +83,7 @@ public class TraverseDuplicatesUnitTest extends BaseTest {
}
Set<List<SAMRecord>> myPairing = obj.uniqueReadSets(list);
Assert.assertEquals(10, myPairing.size()); // unique
Assert.assertEquals(myPairing.size(), 10); // unique
}
@Test
@ -96,7 +98,7 @@ public class TraverseDuplicatesUnitTest extends BaseTest {
list.add(ArtificialSAMUtils.createArtificialRead(header, String.valueOf(x), 0, x, 100));
Set<List<SAMRecord>> myPairing = obj.uniqueReadSets(list);
Assert.assertEquals(6, myPairing.size()); // unique
Assert.assertEquals(myPairing.size(), 6); // unique
}
@Test
@ -112,7 +114,7 @@ public class TraverseDuplicatesUnitTest extends BaseTest {
}
Set<List<SAMRecord>> myPairing = obj.uniqueReadSets(list);
Assert.assertEquals(1, myPairing.size()); // unique
Assert.assertEquals(myPairing.size(), 1); // unique
}
@Test
@ -128,7 +130,7 @@ public class TraverseDuplicatesUnitTest extends BaseTest {
}
Set<List<SAMRecord>> myPairing = obj.uniqueReadSets(list);
Assert.assertEquals(1, myPairing.size()); // unique
Assert.assertEquals(myPairing.size(), 1); // unique
}
@Test
@ -144,6 +146,6 @@ public class TraverseDuplicatesUnitTest extends BaseTest {
}
Set<List<SAMRecord>> myPairing = obj.uniqueReadSets(list);
Assert.assertEquals(10, myPairing.size()); // unique
Assert.assertEquals(myPairing.size(), 10); // unique
}
}

View File

@ -3,7 +3,6 @@ package org.broadinstitute.sting.gatk.traversals;
import net.sf.picard.reference.ReferenceSequenceFile;
import net.sf.picard.reference.IndexedFastaSequenceFile;
import org.broadinstitute.sting.BaseTest;
import org.broadinstitute.sting.gatk.ReadProperties;
import org.broadinstitute.sting.gatk.ReadMetrics;
import org.broadinstitute.sting.gatk.datasources.providers.ShardDataProvider;
import org.broadinstitute.sting.gatk.datasources.providers.ReadShardDataProvider;
@ -15,15 +14,18 @@ import org.broadinstitute.sting.gatk.datasources.simpleDataSources.SAMReaderID;
import org.broadinstitute.sting.gatk.walkers.qc.CountReadsWalker;
import org.broadinstitute.sting.gatk.walkers.Walker;
import org.broadinstitute.sting.utils.GenomeLocParser;
import static org.junit.Assert.fail;
import org.junit.Before;
import org.junit.Test;
import static org.testng.Assert.fail;
import org.broadinstitute.sting.utils.GenomeLocParserTestUtils;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintStream;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
import java.util.Collections;
@ -65,12 +67,21 @@ public class TraverseReadsUnitTest extends BaseTest {
private long readSize = 100000;
private TraverseReads traversalEngine = null;
private IndexedFastaSequenceFile ref = null;
@BeforeClass
public void doOnce() {
GenomeLocParserTestUtils.clearSequenceDictionary();
ref = new IndexedFastaSequenceFile(refFile);
GenomeLocParser.setupRefContigOrdering(ref);
}
/**
* This function does the setup of our parser, before each method call.
* <p/>
* Called before every test case method.
*/
@Before
@BeforeMethod
public void doForEachTest() {
output = new File("testOut.txt");
FileOutputStream out = null;
@ -95,10 +106,6 @@ public class TraverseReadsUnitTest extends BaseTest {
/** Test out that we can shard the file and iterate over every read */
@Test
public void testUnmappedReadCount() {
IndexedFastaSequenceFile ref = null;
ref = new IndexedFastaSequenceFile(refFile);
GenomeLocParser.setupRefContigOrdering(ref);
SAMDataSource dataSource = new SAMDataSource(bamList);
ShardStrategy shardStrategy = ShardStrategyFactory.shatter(dataSource,ref,ShardStrategyFactory.SHATTER_STRATEGY.READS_EXPERIMENTAL,
ref.getSequenceDictionary(),

View File

@ -25,7 +25,7 @@
package org.broadinstitute.sting.gatk.walkers;
import org.broadinstitute.sting.WalkerTest;
import org.junit.Test;
import org.testng.annotations.Test;
import java.io.File;
import java.util.Arrays;
@ -77,4 +77,4 @@ public class ClipReadsWalkersIntegrationTest extends WalkerTest {
Arrays.asList("55c01ccc2e84481b22d3632cdb06c8ba", "22db22749f811d30216215e047461621"));
executeTest("clipOriginalQuals", spec);
}
}
}

View File

@ -1,7 +1,7 @@
package org.broadinstitute.sting.gatk.walkers;
import org.broadinstitute.sting.WalkerTest;
import org.junit.Test;
import org.testng.annotations.Test;
import java.util.Arrays;

View File

@ -1,19 +1,17 @@
package org.broadinstitute.sting.gatk.walkers;
import org.broadinstitute.sting.BaseTest;
import org.broadinstitute.sting.gatk.datasources.shards.Shard;
import org.broadinstitute.sting.gatk.datasources.providers.ShardDataProvider;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.utils.sam.ArtificialReadsTraversal;
import org.broadinstitute.sting.utils.sam.ArtificialSAMFileWriter;
import org.broadinstitute.sting.utils.sam.ArtificialSAMUtils;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import net.sf.samtools.SAMRecord;
import net.sf.samtools.SAMFileHeader;
import net.sf.samtools.SAMFileWriterFactory;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/*
@ -60,7 +58,7 @@ public class PrintReadsWalkerUnitTest extends BaseTest {
private ReferenceContext bases = null;
//private ReferenceContext ref = new ReferenceContext()
@Before
@BeforeMethod
public void before() {
trav = new ArtificialReadsTraversal();
readTotal = ( ( trav.endingChr - trav.startingChr ) + 1 ) * trav.readsPerChr + trav.unMappedReads;
@ -74,7 +72,7 @@ public class PrintReadsWalkerUnitTest extends BaseTest {
walker.out = writer;
trav.traverse(walker, null, writer);
assertEquals(readTotal, writer.getRecords().size());
assertEquals(writer.getRecords().size(), readTotal);
}
/** test that we're ok with a null read */

View File

@ -1,7 +1,7 @@
package org.broadinstitute.sting.gatk.walkers;
import org.broadinstitute.sting.WalkerTest;
import org.junit.Test;
import org.testng.annotations.Test;
import java.util.List;
import java.util.ArrayList;

View File

@ -1,7 +1,7 @@
package org.broadinstitute.sting.gatk.walkers.annotator;
import org.broadinstitute.sting.WalkerTest;
import org.junit.Test;
import org.testng.annotations.Test;
import java.util.Arrays;

View File

@ -4,7 +4,7 @@ package org.broadinstitute.sting.gatk.walkers.annotator.genomicannotator;
import java.util.Arrays;
import org.broadinstitute.sting.WalkerTest;
import org.junit.Test;
import org.testng.annotations.Test;
public class
GenomicAnnotatorIntegrationTest extends WalkerTest {

View File

@ -26,7 +26,7 @@
package org.broadinstitute.sting.gatk.walkers.beagle;
import org.broadinstitute.sting.WalkerTest;
import org.junit.Test;
import org.testng.annotations.Test;
import java.util.Arrays;
@ -77,4 +77,4 @@ public class BeagleIntegrationTest extends WalkerTest {
executeTest("testBeagleChangesSitesToRef",spec);
}
}
}

View File

@ -25,7 +25,7 @@
package org.broadinstitute.sting.gatk.walkers.coverage;
import org.broadinstitute.sting.WalkerTest;
import org.junit.Test;
import org.testng.annotations.Test;
import java.util.Arrays;
@ -65,4 +65,4 @@ public class CallableLociWalkerIntegrationTest extends WalkerTest {
Arrays.asList("86bd1a5f79356b3656412c4b1c60709a", "6fefb144a60b89c27293ce5ca6e10e6a"));
executeTest("formatBed lots of arguments", spec);
}
}
}

View File

@ -25,7 +25,7 @@
package org.broadinstitute.sting.gatk.walkers.coverage;
import org.broadinstitute.sting.WalkerTest;
import org.junit.Test;
import org.testng.annotations.Test;
import java.util.Arrays;
@ -38,4 +38,4 @@ public class CompareCallableLociWalkerIntegrationTest extends WalkerTest {
WalkerTestSpec spec = new WalkerTestSpec(gatk_args, 1, Arrays.asList("70efebac55ff210bb022e9e22ed80a95"));
executeTest("CompareCallableLoci Walker", spec);
}
}
}

View File

@ -1,7 +1,7 @@
package org.broadinstitute.sting.gatk.walkers.coverage;
import org.broadinstitute.sting.WalkerTest;
import org.junit.Test;
import org.testng.annotations.Test;
import java.io.File;
import java.util.ArrayList;

View File

@ -1,7 +1,7 @@
package org.broadinstitute.sting.gatk.walkers.coverage;
import org.broadinstitute.sting.WalkerTest;
import org.junit.Test;
import org.testng.annotations.Test;
import java.io.File;
import java.util.ArrayList;

View File

@ -1,7 +1,7 @@
package org.broadinstitute.sting.gatk.walkers.fasta;
import org.broadinstitute.sting.WalkerTest;
import org.junit.Test;
import org.testng.annotations.Test;
import java.util.Arrays;

View File

@ -1,7 +1,7 @@
package org.broadinstitute.sting.gatk.walkers.filters;
import org.broadinstitute.sting.WalkerTest;
import org.junit.Test;
import org.testng.annotations.Test;
import java.util.Arrays;
@ -75,4 +75,4 @@ public class VariantFiltrationIntegrationTest extends WalkerTest {
Arrays.asList("e8b80ce01f631c840336792cfbf35254"));
executeTest("test genotype filter #2", spec);
}
}
}

View File

@ -1,9 +1,10 @@
package org.broadinstitute.sting.gatk.walkers.genotyper;
import org.testng.Assert;
import org.broadinstitute.sting.utils.genotype.DiploidGenotype;
import org.broadinstitute.sting.BaseTest;
import org.junit.Test;
import org.junit.Assert;
import org.testng.annotations.Test;
import static java.lang.Math.log10;
@ -13,7 +14,7 @@ public class GenotypeLikelihoodsUnitTest extends BaseTest {
@Test
public void testBasic() {
logger.warn("Executing testIsBetween");
Assert.assertEquals(DiploidGenotypePriors.HUMAN_HETEROZYGOSITY,1e-3, DELTA);
Assert.assertEquals(DELTA, DiploidGenotypePriors.HUMAN_HETEROZYGOSITY,1e-3);
}
@ -30,13 +31,13 @@ public class GenotypeLikelihoodsUnitTest extends BaseTest {
testPriorsFromHet(0.5, 0.25, 0.5, 0.25);
}
@Test (expected = RuntimeException.class)
@Test(expectedExceptions=RuntimeException.class)
public void testPriorsFromHetFail1() {
logger.warn("Executing testPriorsFromHetFail1");
testPriorsFromHet(1.0, 0, 0, 0);
}
@Test (expected = RuntimeException.class)
@Test(expectedExceptions=RuntimeException.class)
public void testPriorsFromHetFail2() {
logger.warn("Executing testPriorsFromHetFail2");
testPriorsFromHet(-1.0, 0, 0, 0);
@ -76,7 +77,7 @@ public class GenotypeLikelihoodsUnitTest extends BaseTest {
val = log10(val);
double e = array[g.ordinal()];
Assert.assertEquals(String.format("%s should have p=%f but has p=%f", g, val, e), val, e, DELTA);
Assert.assertEquals(val, e, DELTA, String.format("%s should have p=%f but has p=%f", g, val, e));
}
}
@ -103,7 +104,7 @@ public class GenotypeLikelihoodsUnitTest extends BaseTest {
for ( DiploidGenotype g : DiploidGenotype.values() ) {
double val = Math.pow(10, priors.getPrior(g));
double e = array[g.ordinal()];
Assert.assertEquals(String.format("%s should have p=%f but has p=%f", g, val, e), e, val, DELTA);
Assert.assertEquals(val, e, DELTA, String.format("%s should have p=%f but has p=%f", g, val, e));
}
}
}
}

View File

@ -1,7 +1,7 @@
package org.broadinstitute.sting.gatk.walkers.genotyper;
import org.broadinstitute.sting.WalkerTest;
import org.junit.Test;
import org.testng.annotations.Test;
import java.util.Arrays;
import java.util.HashMap;

View File

@ -1,7 +1,7 @@
package org.broadinstitute.sting.gatk.walkers.genotyper;
import org.broadinstitute.sting.WalkerTest;
import org.junit.Test;
import org.testng.annotations.Test;
import java.util.ArrayList;

View File

@ -1,7 +1,7 @@
package org.broadinstitute.sting.gatk.walkers.indels;
import org.broadinstitute.sting.WalkerTest;
import org.junit.Test;
import org.testng.annotations.Test;
import java.util.Arrays;
@ -36,4 +36,4 @@ public class IndelRealignerIntegrationTest extends WalkerTest {
Arrays.asList(md5s));
executeTest("test realigner known indels only", spec);
}
}
}

View File

@ -1,7 +1,7 @@
package org.broadinstitute.sting.gatk.walkers.indels;
import org.broadinstitute.sting.WalkerTest;
import org.junit.Test;
import org.testng.annotations.Test;
import java.util.ArrayList;
@ -39,4 +39,4 @@ public class IndelRealignerPerformanceTest extends WalkerTest {
new ArrayList<String>(0));
executeTest("testIndelRealignerWholeExome", spec2);
}
}
}

View File

@ -1,7 +1,7 @@
package org.broadinstitute.sting.gatk.walkers.indels;
import org.broadinstitute.sting.WalkerTest;
import org.junit.Test;
import org.testng.annotations.Test;
import java.util.Arrays;

View File

@ -1,7 +1,7 @@
package org.broadinstitute.sting.gatk.walkers.indels;
import org.broadinstitute.sting.WalkerTest;
import org.junit.Test;
import org.testng.annotations.Test;
import java.util.ArrayList;
@ -31,4 +31,4 @@ public class RealignerTargetCreatorPerformanceTest extends WalkerTest {
new ArrayList<String>(0));
executeTest("testRealignerTargetCreatorWholeExome", spec2);
}
}
}

View File

@ -1,7 +1,7 @@
package org.broadinstitute.sting.gatk.walkers.phasing;
import org.broadinstitute.sting.WalkerTest;
import org.junit.Test;
import org.testng.annotations.Test;
import java.util.Arrays;
@ -48,4 +48,4 @@ public class MergeSegregatingAlternateAllelesIntegrationTest extends WalkerTest
}
}
}

View File

@ -1,7 +1,7 @@
package org.broadinstitute.sting.gatk.walkers.phasing;
import org.broadinstitute.sting.WalkerTest;
import org.junit.Test;
import org.testng.annotations.Test;
import java.util.Arrays;
@ -80,4 +80,4 @@ public class ReadBackedPhasingIntegrationTest extends WalkerTest {
executeTest("MAX 10 het sites [TEST SIX]; require PQ >= 10; cacheWindow = 20000; has inconsistent sites", spec);
}
}
}

View File

@ -27,7 +27,7 @@ package org.broadinstitute.sting.gatk.walkers.qc;
import org.broadinstitute.sting.BaseTest;
import org.broadinstitute.sting.WalkerTest;
import org.broadinstitute.sting.utils.exceptions.UserException;
import org.junit.Test;
import org.testng.annotations.Test;
/**
*

View File

@ -1,6 +1,6 @@
package org.broadinstitute.sting.gatk.walkers.qc;
import org.junit.Test;
import org.testng.annotations.Test;
import org.broadinstitute.sting.WalkerTest;
import java.util.Collections;

View File

@ -2,7 +2,7 @@ package org.broadinstitute.sting.gatk.walkers.recalibration;
import org.broadinstitute.sting.WalkerTest;
import org.broadinstitute.sting.utils.exceptions.UserException;
import org.junit.Test;
import org.testng.annotations.Test;
import java.util.HashMap;
import java.util.Map;

View File

@ -1,7 +1,7 @@
package org.broadinstitute.sting.gatk.walkers.recalibration;
import org.broadinstitute.sting.WalkerTest;
import org.junit.Test;
import org.testng.annotations.Test;
import java.util.ArrayList;
@ -77,4 +77,4 @@ public class RecalibrationWalkersPerformanceTest extends WalkerTest {
new ArrayList<String>(0));
executeTest("testTableRecalibratorWholeExome", spec);
}
}
}

View File

@ -1,7 +1,7 @@
package org.broadinstitute.sting.gatk.walkers.sequenom;
import org.broadinstitute.sting.WalkerTest;
import org.junit.Test;
import org.testng.annotations.Test;
import java.util.Arrays;

View File

@ -1,7 +1,7 @@
package org.broadinstitute.sting.gatk.walkers.varianteval;
import org.broadinstitute.sting.WalkerTest;
import org.junit.Test;
import org.testng.annotations.Test;
import java.util.Arrays;
import java.util.HashMap;
@ -31,6 +31,7 @@ public class
WalkerTestSpec spec = new WalkerTestSpec(withSelect(tests, "DP < 50", "DP50") + " " + extraArgs + " -o %s",
1, Arrays.asList("158ac8e6d32eb2ea1bbeebfa512965de"));
executeTestParallel("testSelect1", spec);
//executeTest("testSelect1", spec);
}
}
@ -40,6 +41,7 @@ public class
WalkerTestSpec spec = new WalkerTestSpec( withSelect(withSelect(root, "DP < 50", "DP50"), "set==\"Intersection\"", "intersection") + " " + extraArgs + " -o %s",
1, Arrays.asList("cee96f61ffa1d042fe0c63550c508ec9"));
executeTestParallel("testSelect2", spec);
//executeTest("testSelect2", spec);
}
@Test
@ -50,6 +52,7 @@ public class
1,
Arrays.asList("7e9ce1b26cdeaa50705f5de163847638"));
executeTestParallel("testVEGenotypeConcordance" + vcfFile, spec);
//executeTest("testVEGenotypeConcordance" + vcfFile, spec);
}
}
@ -68,6 +71,7 @@ public class
1, // just one output file
Arrays.asList(md5));
executeTestParallel("testVESimple", spec);
//executeTest("testVESimple", spec);
}
}
}
@ -93,6 +97,7 @@ public class
1, // just one output file
Arrays.asList(md5));
executeTestParallel("testVEComplex", spec);
//executeTest("testVEComplex", spec);
}
}
}
@ -110,6 +115,7 @@ public class
WalkerTestSpec spec = new WalkerTestSpec(vecmd, 1, Arrays.asList(md5));
executeTestParallel("testVEGenomicallyAnnotated", spec);
//executeTest("testVEGenomicallyAnnotated", spec);
}
@Test
@ -120,6 +126,7 @@ public class
2,
Arrays.asList("6b97a019402b3984fead9a4e8b7c7c2a", "989bc30dea6c8a4cf771cd1b9fdab488"));
executeTestParallel("testVEWriteVCF", spec);
//executeTest("testVEWriteVCF", spec);
}
}
@ -128,6 +135,7 @@ public class
String extraArgs = "-T VariantEval -R "+b36KGReference+" -o %s -E GenotypeConcordance -B:evalYRI,VCF /humgen/gsa-hpprojects/GATK/data/Validation_Data/yri.trio.gatk.ug.very.few.lines.vcf -B:compYRI,VCF /humgen/gsa-hpprojects/GATK/data/Validation_Data/yri.trio.gatk.fake.genotypes.ac.test.vcf -reportType CSV";
WalkerTestSpec spec = new WalkerTestSpec(extraArgs,1,Arrays.asList("25a681855cb26e7380fbf1a93de0a41f"));
executeTestParallel("testACDiscordanceAtAC1EvalAC2Comp",spec);
//executeTest("testACDiscordanceAtAC1EvalAC2Comp",spec);
}
private static String withSelect(String cmd, String select, String name) {

View File

@ -2,7 +2,7 @@ package org.broadinstitute.sting.gatk.walkers.variantrecalibration;
import org.broadinstitute.sting.WalkerTest;
import org.broadinstitute.sting.utils.exceptions.UserException;
import org.junit.Test;
import org.testng.annotations.Test;
import java.util.*;
import java.io.File;

View File

@ -25,7 +25,7 @@
package org.broadinstitute.sting.gatk.walkers.variantutils;
import org.broadinstitute.sting.WalkerTest;
import org.junit.Test;
import org.testng.annotations.Test;
import java.io.File;
import java.util.Arrays;

View File

@ -3,10 +3,11 @@ package org.broadinstitute.sting.gatk.walkers.variantutils;
import org.broad.tribble.vcf.VCFCodec;
import org.broad.tribble.vcf.VCFHeader;
import org.broad.tribble.vcf.VCFHeaderLine;
import org.testng.Assert;
import org.broadinstitute.sting.utils.genotype.vcf.VCFHeaderUnitTest;
import org.broadinstitute.sting.utils.vcf.VCFUtils;
import org.junit.Assert;
import org.junit.Test;
import org.testng.annotations.Test;
import java.util.ArrayList;
import java.util.List;
@ -65,7 +66,7 @@ public class CombineVariantsUnitTest {
for (String str : headerStr)
headerFields.add(str);
VCFHeader head = (VCFHeader)codec.createHeader(headerFields,"#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO");
Assert.assertEquals(headerStr.length /* for the # line */,head.getMetaData().size());
Assert.assertEquals(head.getMetaData().size(), headerStr.length /* for the # line */);
return head;
}
@ -77,10 +78,10 @@ public class CombineVariantsUnitTest {
headers.add(one);
headers.add(two);
Set<VCFHeaderLine> lines = VCFUtils.smartMergeHeaders(headers, null);
Assert.assertEquals(VCFHeaderUnitTest.VCF4headerStrings.length,lines.size());
Assert.assertEquals(lines.size(), VCFHeaderUnitTest.VCF4headerStrings.length);
}
@Test(expected=IllegalStateException.class)
@Test(expectedExceptions=IllegalStateException.class)
public void testHeadersInfoDifferentValues() {
VCFHeader one = createHeader(VCFHeaderUnitTest.VCF4headerStrings);
VCFHeader two = createHeader(VCF4headerStringsBrokenInfo);
@ -88,7 +89,7 @@ public class CombineVariantsUnitTest {
headers.add(one);
headers.add(two);
Set<VCFHeaderLine> lines = VCFUtils.smartMergeHeaders(headers, null);
Assert.assertEquals(VCFHeaderUnitTest.VCF4headerStrings.length,lines.size());
Assert.assertEquals(lines.size(), VCFHeaderUnitTest.VCF4headerStrings.length);
}
@Test
@ -99,6 +100,6 @@ public class CombineVariantsUnitTest {
headers.add(one);
headers.add(two);
Set<VCFHeaderLine> lines = VCFUtils.smartMergeHeaders(headers, null);
Assert.assertEquals(VCFHeaderUnitTest.VCF4headerStrings.length,lines.size());
Assert.assertEquals(lines.size(), VCFHeaderUnitTest.VCF4headerStrings.length);
}
}

View File

@ -26,7 +26,7 @@
package org.broadinstitute.sting.gatk.walkers.variantutils;
import org.broadinstitute.sting.WalkerTest;
import org.junit.Test;
import org.testng.annotations.Test;
import java.util.Arrays;
@ -52,4 +52,4 @@ public class LiftoverVariantsIntegrationTest extends WalkerTest {
Arrays.asList("22d4cd78d72da55f2423b9ab06f467b2"));
executeTest("test hg18 to hg19, unsorted", spec);
}
}
}

View File

@ -1,7 +1,7 @@
package org.broadinstitute.sting.gatk.walkers.variantutils;
import org.broadinstitute.sting.WalkerTest;
import org.junit.Test;
import org.testng.annotations.Test;
import java.util.Arrays;

View File

@ -27,7 +27,7 @@ package org.broadinstitute.sting.gatk.walkers.variantutils;
import org.broadinstitute.sting.WalkerTest;
import org.broadinstitute.sting.utils.exceptions.UserException;
import org.junit.Test;
import org.testng.annotations.Test;
import java.util.Arrays;
@ -113,4 +113,4 @@ public class ValidateVariantsIntegrationTest extends WalkerTest {
executeTest("test bad alt allele", spec);
}
}
}

View File

@ -1,7 +1,7 @@
package org.broadinstitute.sting.oneoffprojects.walkers;
import org.broadinstitute.sting.WalkerTest;
import org.junit.Test;
import org.testng.annotations.Test;
import java.util.Arrays;

View File

@ -26,7 +26,7 @@
package org.broadinstitute.sting.playground.gatk.walkers.HLAcaller;
import org.broadinstitute.sting.WalkerTest;
import org.junit.Test;
import org.testng.annotations.Test;
import java.util.Arrays;
@ -58,4 +58,4 @@ public class HLACallerIntegrationTest extends WalkerTest {
Arrays.asList("f9931b378bde213e71fca6ecaa24b48b"));
executeTest("test HLACaller", spec);
}
}
}

View File

@ -1,7 +1,7 @@
package org.broadinstitute.sting.playground.gatk.walkers.duplicates;
import org.broadinstitute.sting.WalkerTest;
import org.junit.Test;
import org.testng.annotations.Test;
import java.io.File;
import java.util.Arrays;
@ -37,4 +37,4 @@ public class DuplicatesWalkersIntegrationTest extends WalkerTest {
@Test public void testIntervalCombine() { testCombiner("testIntervalCombine", "-L chr1:6,527,154-6,528,292 -maxQ 50", "d41d8cd98f00b204e9800998ecf8427e", "4541f57820637039bc2f5a97bcaadfe4"); }
@Test public void testIntervalCombineQ60() { testCombiner("testIntervalCombine", "-L chr1:6,527,154-6,528,292 -maxQ 60", "d41d8cd98f00b204e9800998ecf8427e", "8c0350c0a697e4083aab6ead3f404de4"); }
}
}

View File

@ -1,7 +1,7 @@
package org.broadinstitute.sting.playground.gatk.walkers.validation;
import org.broadinstitute.sting.WalkerTest;
import org.junit.Test;
import org.testng.annotations.Test;
import java.util.Arrays;

View File

@ -1,13 +1,14 @@
package org.broadinstitute.sting.utils;
import org.testng.Assert;
import org.broadinstitute.sting.BaseTest;
import org.junit.Test;
import org.junit.BeforeClass;
import org.junit.Assert;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeClass;
public class BaseUtilsUnitTest extends BaseTest {
@BeforeClass
public static void init() { }
public void init() { }
@Test
public void testMostFrequentBaseFraction() {

View File

@ -2,15 +2,15 @@ package org.broadinstitute.sting.utils;
import net.sf.samtools.SAMFileHeader;
import net.sf.samtools.SAMSequenceDictionary;
import org.broadinstitute.sting.BaseTest;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import org.broadinstitute.sting.utils.sam.ArtificialSAMUtils;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
/**
* @author aaron
@ -20,14 +20,21 @@ import org.junit.Test;
* Test out the functionality of the new genome loc parser
*/
public class GenomeLocParserUnitTest extends BaseTest {
@Test(expected = ReviewedStingException.class)
@Test(expectedExceptions=ReviewedStingException.class)
public void testUnsetupException() {
SAMSequenceDictionary contigInfoCache = GenomeLocParser.contigInfo;
GenomeLocParser.contigInfo = null;
GenomeLocParser.createGenomeLoc(0, 0, 0);
try {
GenomeLocParser.createGenomeLoc(0, 0, 0);
}
finally {
GenomeLocParser.contigInfo = contigInfoCache;
}
}
@BeforeClass
public static void init() {
public void init() {
GenomeLocParserTestUtils.clearSequenceDictionary();
SAMFileHeader header = ArtificialSAMUtils.createArtificialSamHeader(1, 1, 10);
GenomeLocParser.setupRefContigOrdering(header.getSequenceDictionary());
}
@ -43,15 +50,15 @@ public class GenomeLocParserUnitTest extends BaseTest {
assertTrue(GenomeLocParser.hasKnownContigOrdering());
}
@Test(expected = RuntimeException.class)
@Test(expectedExceptions=RuntimeException.class)
public void testGetContigIndex() {
assertEquals(-1, GenomeLocParser.getContigIndex("blah",true)); // should not be in the reference
assertEquals(GenomeLocParser.getContigIndex("blah",true), -1); // should not be in the reference
}
@Test
public void testGetContigIndexValid() {
SAMFileHeader header = ArtificialSAMUtils.createArtificialSamHeader(1, 1, 10);
assertEquals(0, GenomeLocParser.getContigIndex("chr1",true)); // should be in the reference
assertEquals(GenomeLocParser.getContigIndex("chr1",true), 0); // should be in the reference
}
@Test
@ -63,10 +70,10 @@ public class GenomeLocParserUnitTest extends BaseTest {
@Test
public void testGetContigInfoKnownContig() {
SAMFileHeader header = ArtificialSAMUtils.createArtificialSamHeader(1, 1, 10);
assertEquals("chr1".compareTo(GenomeLocParser.getContigInfo("chr1").getSequenceName()), 0); // should be in the reference
assertEquals(0, "chr1".compareTo(GenomeLocParser.getContigInfo("chr1").getSequenceName())); // should be in the reference
}
@Test(expected = ReviewedStingException.class)
@Test(expectedExceptions=ReviewedStingException.class)
public void testParseBadString() {
GenomeLocParser.parseGenomeLoc("Bad:0-1");
}
@ -74,106 +81,106 @@ public class GenomeLocParserUnitTest extends BaseTest {
@Test
public void testParseGoodString() {
GenomeLoc loc = GenomeLocParser.parseGenomeLoc("chr1:1-100");
assertEquals(loc.getContigIndex(), 0);
assertEquals(100, loc.getStop());
assertEquals(1, loc.getStart());
assertEquals(0, loc.getContigIndex());
assertEquals(loc.getStop(), 100);
assertEquals(loc.getStart(), 1);
}
@Test
public void testCreateGenomeLoc1() {
GenomeLoc loc = GenomeLocParser.createGenomeLoc("chr1", 1, 100);
assertEquals(loc.getContigIndex(), 0);
assertEquals(100, loc.getStop());
assertEquals(1, loc.getStart());
assertEquals(0, loc.getContigIndex());
assertEquals(loc.getStop(), 100);
assertEquals(loc.getStart(), 1);
}
@Test
public void testCreateGenomeLoc1point5() { // in honor of VAAL!
GenomeLoc loc = GenomeLocParser.parseGenomeLoc("chr1:1");
assertEquals(loc.getContigIndex(), 0);
assertEquals(1, loc.getStop());
assertEquals(1, loc.getStart());
assertEquals(0, loc.getContigIndex());
assertEquals(loc.getStop(), 1);
assertEquals(loc.getStart(), 1);
}
@Test
public void testCreateGenomeLoc2() {
GenomeLoc loc = GenomeLocParser.createGenomeLoc(0, 1, 100);
assertEquals(loc.getContigIndex(), 0);
assertEquals(100, loc.getStop());
assertEquals(1, loc.getStart());
assertEquals(0, loc.getContigIndex());
assertEquals(loc.getStop(), 100);
assertEquals(loc.getStart(), 1);
}
@Test
public void testCreateGenomeLoc3() {
GenomeLoc loc = GenomeLocParser.createGenomeLoc(0, 1);
assertEquals(loc.getContigIndex(), 0);
assertEquals(1, loc.getStop());
assertEquals(1, loc.getStart());
assertEquals(0, loc.getContigIndex());
assertEquals(loc.getStop(), 1);
assertEquals(loc.getStart(), 1);
}
@Test
public void testCreateGenomeLoc4() {
GenomeLoc loc = GenomeLocParser.createGenomeLoc("chr1", 1);
assertEquals(loc.getContigIndex(), 0);
assertEquals(1, loc.getStop());
assertEquals(1, loc.getStart());
assertEquals(0, loc.getContigIndex());
assertEquals(loc.getStop(), 1);
assertEquals(loc.getStart(), 1);
}
@Test
public void testCreateGenomeLoc5() {
GenomeLoc loc = GenomeLocParser.createGenomeLoc(0, 1, 100);
GenomeLoc copy = GenomeLocParser.createGenomeLoc(loc);
assertEquals(copy.getContigIndex(), 0);
assertEquals(100, copy.getStop());
assertEquals(1, copy.getStart());
assertEquals(0, copy.getContigIndex());
assertEquals(copy.getStop(), 100);
assertEquals(copy.getStart(), 1);
}
@Test
public void testGenomeLocPlusSign() {
GenomeLoc loc = GenomeLocParser.parseGenomeLoc("chr1:1+");
assertEquals(0, loc.getContigIndex());
assertEquals(10, loc.getStop()); // the size
assertEquals(1, loc.getStart());
assertEquals(loc.getContigIndex(), 0);
assertEquals(loc.getStop(), 10); // the size
assertEquals(loc.getStart(), 1);
}
@Test
public void testGenomeLocParseOnlyChrome() {
GenomeLoc loc = GenomeLocParser.parseGenomeLoc("chr1");
assertEquals(0, loc.getContigIndex());
assertEquals(10, loc.getStop()); // the size
assertEquals(1, loc.getStart());
assertEquals(loc.getContigIndex(), 0);
assertEquals(loc.getStop(), 10); // the size
assertEquals(loc.getStart(), 1);
}
@Test(expected = ReviewedStingException.class)
@Test(expectedExceptions=ReviewedStingException.class)
public void testGenomeLocParseOnlyBadChrome() {
GenomeLoc loc = GenomeLocParser.parseGenomeLoc("chr12");
assertEquals(0, loc.getContigIndex());
assertEquals(10, loc.getStop()); // the size
assertEquals(1, loc.getStart());
assertEquals(loc.getContigIndex(), 0);
assertEquals(loc.getStop(), 10); // the size
assertEquals(loc.getStart(), 1);
}
@Test(expected = ReviewedStingException.class)
@Test(expectedExceptions=ReviewedStingException.class)
public void testGenomeLocBad() {
GenomeLoc loc = GenomeLocParser.parseGenomeLoc("chr1:1-");
assertEquals(0, loc.getContigIndex());
assertEquals(10, loc.getStop()); // the size
assertEquals(1, loc.getStart());
assertEquals(loc.getContigIndex(), 0);
assertEquals(loc.getStop(), 10); // the size
assertEquals(loc.getStart(), 1);
}
@Test(expected = ReviewedStingException.class)
@Test(expectedExceptions=ReviewedStingException.class)
public void testGenomeLocBad2() {
GenomeLoc loc = GenomeLocParser.parseGenomeLoc("chr1:1-500-0");
assertEquals(0, loc.getContigIndex());
assertEquals(10, loc.getStop()); // the size
assertEquals(1, loc.getStart());
assertEquals(loc.getContigIndex(), 0);
assertEquals(loc.getStop(), 10); // the size
assertEquals(loc.getStart(), 1);
}
@Test(expected = ReviewedStingException.class)
@Test(expectedExceptions=ReviewedStingException.class)
public void testGenomeLocBad3() {
GenomeLoc loc = GenomeLocParser.parseGenomeLoc("chr1:1--0");
assertEquals(0, loc.getContigIndex());
assertEquals(10, loc.getStop()); // the size
assertEquals(1, loc.getStart());
assertEquals(loc.getContigIndex(), 0);
assertEquals(loc.getStop(), 10); // the size
assertEquals(loc.getStart(), 1);
}
// test out the validating methods

View File

@ -4,10 +4,13 @@ import net.sf.samtools.SAMFileHeader;
import org.broadinstitute.sting.BaseTest;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import org.broadinstitute.sting.utils.sam.ArtificialSAMUtils;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.util.Iterator;
import java.util.Arrays;
@ -45,10 +48,15 @@ public class GenomeLocSortedSetUnitTest extends BaseTest {
private static final int STARTING_CHROMOSOME = 1;
private static final int CHROMOSOME_SIZE = 1000;
@Before
@BeforeClass
public void setup() {
GenomeLocParserTestUtils.clearSequenceDictionary();
GenomeLocParser.setupRefContigOrdering(header.getSequenceDictionary());
mSortedSet = new GenomeLocSortedSet();
}
@BeforeMethod
public void initializeSortedSet() {
mSortedSet = new GenomeLocSortedSet();
}
@Test
@ -81,8 +89,8 @@ public class GenomeLocSortedSetUnitTest extends BaseTest {
}
@Test(expected = ReviewedStingException.class)
public void testAddDupplicate() {
@Test(expectedExceptions=ReviewedStingException.class)
public void testAddDuplicate() {
assertTrue(mSortedSet.size() == 0);
GenomeLoc g = GenomeLocParser.createGenomeLoc(1, 0, 0);
mSortedSet.add(g);
@ -186,9 +194,9 @@ public class GenomeLocSortedSetUnitTest extends BaseTest {
// logger.debug("Exclude " + toExclude);
// logger.debug("Remaining " + remaining);
assertEquals(20, mSortedSet.coveredSize());
assertEquals(9, toExclude.coveredSize());
assertEquals(11, remaining.coveredSize());
assertEquals(mSortedSet.coveredSize(), 20);
assertEquals(toExclude.coveredSize(), 9);
assertEquals(remaining.coveredSize(), 11);
Iterator<GenomeLoc> it = remaining.iterator();
GenomeLoc p1 = it.next();

View File

@ -4,9 +4,10 @@ package org.broadinstitute.sting.utils;
// the imports for unit testing.
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.broadinstitute.sting.BaseTest;
import java.io.File;
@ -22,8 +23,9 @@ public class GenomeLocUnitTest extends BaseTest {
private static ReferenceSequenceFile seq;
@BeforeClass
public static void init() throws FileNotFoundException {
public void init() throws FileNotFoundException {
// sequence
GenomeLocParserTestUtils.clearSequenceDictionary();
seq = new IndexedFastaSequenceFile(new File(hg18Reference));
GenomeLocParser.setupRefContigOrdering(seq);
}
@ -49,17 +51,17 @@ public class GenomeLocUnitTest extends BaseTest {
public void testContigIndex() {
logger.warn("Executing testContigIndex");
GenomeLoc locOne = GenomeLocParser.createGenomeLoc("chr1",1,1);
Assert.assertEquals(locOne.getContigIndex(), 1);
Assert.assertEquals(locOne.getContig(), "chr1");
Assert.assertEquals(1, locOne.getContigIndex());
Assert.assertEquals("chr1", locOne.getContig());
GenomeLoc locX = GenomeLocParser.createGenomeLoc("chrX",1,1);
Assert.assertEquals(locX.getContigIndex(), 23);
Assert.assertEquals(locX.getContig(), "chrX");
Assert.assertEquals(23, locX.getContigIndex());
Assert.assertEquals("chrX", locX.getContig());
GenomeLoc locNumber = GenomeLocParser.createGenomeLoc(1,1,1);
Assert.assertEquals(locNumber.getContigIndex(), 1);
Assert.assertEquals(locNumber.getContig(), "chr1");
Assert.assertEquals(locOne.compareTo(locNumber), 0);
Assert.assertEquals(1, locNumber.getContigIndex());
Assert.assertEquals("chr1", locNumber.getContig());
Assert.assertEquals(0, locOne.compareTo(locNumber));
}
@ -69,16 +71,16 @@ public class GenomeLocUnitTest extends BaseTest {
GenomeLoc twoOne = GenomeLocParser.createGenomeLoc("chr2", 1);
GenomeLoc twoFive = GenomeLocParser.createGenomeLoc("chr2", 5);
GenomeLoc twoOtherFive = GenomeLocParser.createGenomeLoc("chr2", 5);
Assert.assertEquals(0, twoFive.compareTo(twoOtherFive));
Assert.assertEquals(twoFive.compareTo(twoOtherFive), 0);
Assert.assertEquals(-1, twoOne.compareTo(twoFive));
Assert.assertEquals(1, twoFive.compareTo(twoOne));
Assert.assertEquals(twoOne.compareTo(twoFive), -1);
Assert.assertEquals(twoFive.compareTo(twoOne), 1);
GenomeLoc oneOne = GenomeLocParser.createGenomeLoc("chr1", 5);
Assert.assertEquals(-1, oneOne.compareTo(twoOne));
Assert.assertEquals(1, twoOne.compareTo(oneOne));
Assert.assertEquals(oneOne.compareTo(twoOne), -1);
Assert.assertEquals(twoOne.compareTo(oneOne), 1);
}
}
}

View File

@ -25,14 +25,13 @@
package org.broadinstitute.sting.utils;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.broadinstitute.sting.BaseTest;
import org.broadinstitute.sting.utils.MathUtils;
import java.io.File;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
@ -42,7 +41,7 @@ import java.util.Collections;
*/
public class MathUtilsUnitTest extends BaseTest {
@BeforeClass
public static void init() { }
public void init() { }
/**
* Tests that we get the right values from the binomial distribution
@ -134,9 +133,9 @@ public class MathUtilsUnitTest extends BaseTest {
for ( int i = 0 ; i < numbers.length ; i++ ) r.add((double)numbers[i]);
Assert.assertEquals(r.observationCount(),(long)numbers.length);
Assert.assertEquals((long)numbers.length, r.observationCount());
Assert.assertTrue(r.mean()- 3224.625 < 2e-10 );
Assert.assertTrue(r.stddev()-9072.6515881128 < 2e-10);
}
}
}

View File

@ -1,16 +1,17 @@
package org.broadinstitute.sting.utils;
import org.broadinstitute.sting.BaseTest;
import org.testng.Assert;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.io.File;
public class PathUtilsUnitTest extends BaseTest {
@BeforeClass
public static void init() { }
public void init() { }
/**
* Tests that we can successfully refresh a volume

View File

@ -1,16 +1,13 @@
package org.broadinstitute.sting.utils;
import org.junit.Test;
import org.broadinstitute.sting.utils.sam.AlignmentStartComparator;
import org.testng.Assert;
import org.testng.annotations.Test;
import org.broadinstitute.sting.utils.sam.ArtificialSAMUtils;
import org.broadinstitute.sting.gatk.iterators.NullSAMIterator;
import net.sf.samtools.SAMRecord;
import net.sf.samtools.SAMFileHeader;
import java.util.*;
import junit.framework.Assert;
/**
* Basic tests to prove the integrity of the reservoir downsampler.
* At the moment, always run tests on SAM records as that's the task
@ -26,7 +23,7 @@ public class ReservoirDownsamplerUnitTest {
@Test
public void testEmptyIterator() {
ReservoirDownsampler<SAMRecord> downsampler = new ReservoirDownsampler<SAMRecord>(1);
Assert.assertTrue("Downsampler is not empty but should be.",downsampler.isEmpty());
Assert.assertTrue(downsampler.isEmpty(),"Downsampler is not empty but should be.");
}
@Test
@ -35,10 +32,10 @@ public class ReservoirDownsamplerUnitTest {
ReservoirDownsampler<SAMRecord> downsampler = new ReservoirDownsampler<SAMRecord>(1);
downsampler.addAll(reads);
Assert.assertFalse("Downsampler is empty but shouldn't be",downsampler.isEmpty());
Assert.assertFalse(downsampler.isEmpty(),"Downsampler is empty but shouldn't be");
Collection<SAMRecord> batchedReads = downsampler.getDownsampledContents();
Assert.assertEquals("Downsampler is returning the wrong number of reads",1,batchedReads.size());
Assert.assertSame("Downsampler is returning an incorrect read",reads.get(0),batchedReads.iterator().next());
Assert.assertEquals(batchedReads.size(), 1, "Downsampler is returning the wrong number of reads");
Assert.assertSame(batchedReads.iterator().next(), reads.get(0), "Downsampler is returning an incorrect read");
}
@Test
@ -47,10 +44,10 @@ public class ReservoirDownsamplerUnitTest {
ReservoirDownsampler<SAMRecord> downsampler = new ReservoirDownsampler<SAMRecord>(5);
downsampler.addAll(reads);
Assert.assertFalse("Downsampler is empty but shouldn't be",downsampler.isEmpty());
Assert.assertFalse(downsampler.isEmpty(),"Downsampler is empty but shouldn't be");
Collection<SAMRecord> batchedReads = downsampler.getDownsampledContents();
Assert.assertEquals("Downsampler is returning the wrong number of reads",1,batchedReads.size());
Assert.assertSame("Downsampler is returning an incorrect read",reads.get(0),batchedReads.iterator().next());
Assert.assertEquals(batchedReads.size(), 1, "Downsampler is returning the wrong number of reads");
Assert.assertSame(batchedReads.iterator().next(), reads.get(0), "Downsampler is returning an incorrect read");
}
@ -63,13 +60,13 @@ public class ReservoirDownsamplerUnitTest {
ReservoirDownsampler<SAMRecord> downsampler = new ReservoirDownsampler<SAMRecord>(5);
downsampler.addAll(reads);
Assert.assertFalse("Downsampler is empty but shouldn't be",downsampler.isEmpty());
Assert.assertFalse(downsampler.isEmpty(),"Downsampler is empty but shouldn't be");
List<SAMRecord> batchedReads = new ArrayList<SAMRecord>(downsampler.getDownsampledContents());
Assert.assertEquals("Downsampler is returning the wrong number of reads",3,batchedReads.size());
Assert.assertEquals(batchedReads.size(), 3, "Downsampler is returning the wrong number of reads");
Assert.assertSame("Downsampler read 1 is incorrect",reads.get(0),batchedReads.get(0));
Assert.assertSame("Downsampler read 2 is incorrect",reads.get(1),batchedReads.get(1));
Assert.assertSame("Downsampler read 3 is incorrect",reads.get(2),batchedReads.get(2));
Assert.assertSame(batchedReads.get(0), reads.get(0), "Downsampler read 1 is incorrect");
Assert.assertSame(batchedReads.get(1), reads.get(1), "Downsampler read 2 is incorrect");
Assert.assertSame(batchedReads.get(2), reads.get(2), "Downsampler read 3 is incorrect");
}
@Test
@ -83,16 +80,16 @@ public class ReservoirDownsamplerUnitTest {
ReservoirDownsampler<SAMRecord> downsampler = new ReservoirDownsampler<SAMRecord>(5);
downsampler.addAll(reads);
Assert.assertFalse("Downsampler is empty but shouldn't be",downsampler.isEmpty());
Assert.assertFalse(downsampler.isEmpty(),"Downsampler is empty but shouldn't be");
List<SAMRecord> batchedReads = new ArrayList<SAMRecord>(downsampler.getDownsampledContents());
Assert.assertEquals("Downsampler is returning the wrong number of reads",5,batchedReads.size());
Assert.assertSame("Downsampler is returning an incorrect read",reads.get(0),batchedReads.iterator().next());
Assert.assertEquals(batchedReads.size(), 5, "Downsampler is returning the wrong number of reads");
Assert.assertSame(batchedReads.iterator().next(), reads.get(0), "Downsampler is returning an incorrect read");
Assert.assertSame("Downsampler read 1 is incorrect",reads.get(0),batchedReads.get(0));
Assert.assertSame("Downsampler read 2 is incorrect",reads.get(1),batchedReads.get(1));
Assert.assertSame("Downsampler read 3 is incorrect",reads.get(2),batchedReads.get(2));
Assert.assertSame("Downsampler read 4 is incorrect",reads.get(3),batchedReads.get(3));
Assert.assertSame("Downsampler read 5 is incorrect",reads.get(4),batchedReads.get(4));
Assert.assertSame(batchedReads.get(0), reads.get(0), "Downsampler read 1 is incorrect");
Assert.assertSame(batchedReads.get(1), reads.get(1), "Downsampler read 2 is incorrect");
Assert.assertSame(batchedReads.get(2), reads.get(2), "Downsampler read 3 is incorrect");
Assert.assertSame(batchedReads.get(3), reads.get(3), "Downsampler read 4 is incorrect");
Assert.assertSame(batchedReads.get(4), reads.get(4), "Downsampler read 5 is incorrect");
}
@Test
@ -104,9 +101,9 @@ public class ReservoirDownsamplerUnitTest {
ReservoirDownsampler<SAMRecord> downsampler = new ReservoirDownsampler<SAMRecord>(0);
downsampler.addAll(reads);
Assert.assertTrue("Downsampler isn't empty but should be",downsampler.isEmpty());
Assert.assertTrue(downsampler.isEmpty(),"Downsampler isn't empty but should be");
List<SAMRecord> batchedReads = new ArrayList<SAMRecord>(downsampler.getDownsampledContents());
Assert.assertEquals("Downsampler is returning the wrong number of reads",0,batchedReads.size());
Assert.assertEquals(batchedReads.size(), 0, "Downsampler is returning the wrong number of reads");
}
@Test
@ -120,10 +117,10 @@ public class ReservoirDownsamplerUnitTest {
ReservoirDownsampler<SAMRecord> downsampler = new ReservoirDownsampler<SAMRecord>(1);
downsampler.addAll(reads);
Assert.assertFalse("Downsampler is empty but shouldn't be",downsampler.isEmpty());
Assert.assertFalse(downsampler.isEmpty(),"Downsampler is empty but shouldn't be");
List<SAMRecord> batchedReads = new ArrayList<SAMRecord>(downsampler.getDownsampledContents());
Assert.assertEquals("Downsampler is returning the wrong number of reads",1,batchedReads.size());
Assert.assertTrue("Downsampler is returning a bad read.",reads.contains(batchedReads.get(0))) ;
Assert.assertEquals(batchedReads.size(), 1, "Downsampler is returning the wrong number of reads");
Assert.assertTrue(reads.contains(batchedReads.get(0)),"Downsampler is returning a bad read.");
}
@Test
@ -133,10 +130,10 @@ public class ReservoirDownsamplerUnitTest {
ReservoirDownsampler<SAMRecord> downsampler = new ReservoirDownsampler<SAMRecord>(5);
downsampler.addAll(reads);
Assert.assertFalse("Downsampler is empty but shouldn't be",downsampler.isEmpty());
Assert.assertFalse(downsampler.isEmpty(),"Downsampler is empty but shouldn't be");
List<SAMRecord> batchedReads = new ArrayList<SAMRecord>(downsampler.getDownsampledContents());
Assert.assertEquals("Downsampler is returning the wrong number of reads",1,batchedReads.size());
Assert.assertEquals("Downsampler is returning an incorrect read.",reads.get(0),batchedReads.get(0));
Assert.assertEquals(batchedReads.size(), 1, "Downsampler is returning the wrong number of reads");
Assert.assertEquals(batchedReads.get(0), reads.get(0), "Downsampler is returning an incorrect read.");
reads.clear();
reads.add(ArtificialSAMUtils.createArtificialRead(header,"read2",0,2,76));
@ -145,11 +142,11 @@ public class ReservoirDownsamplerUnitTest {
downsampler.clear();
downsampler.addAll(reads);
Assert.assertFalse("Downsampler is empty but shouldn't be",downsampler.isEmpty());
Assert.assertFalse(downsampler.isEmpty(),"Downsampler is empty but shouldn't be");
batchedReads = new ArrayList<SAMRecord>(downsampler.getDownsampledContents());
Assert.assertEquals("Downsampler is returning the wrong number of reads",2,batchedReads.size());
Assert.assertEquals("Downsampler is returning an incorrect read.",reads.get(0),batchedReads.get(0));
Assert.assertEquals("Downsampler is returning an incorrect read.",reads.get(1),batchedReads.get(1));
Assert.assertEquals(batchedReads.size(), 2, "Downsampler is returning the wrong number of reads");
Assert.assertEquals(batchedReads.get(0), reads.get(0), "Downsampler is returning an incorrect read.");
Assert.assertEquals(batchedReads.get(1), reads.get(1), "Downsampler is returning an incorrect read.");
reads.clear();
reads.add(ArtificialSAMUtils.createArtificialRead(header,"read4",0,3,76));
@ -158,11 +155,11 @@ public class ReservoirDownsamplerUnitTest {
downsampler.clear();
downsampler.addAll(reads);
Assert.assertFalse("Downsampler is empty but shouldn't be",downsampler.isEmpty());
Assert.assertFalse(downsampler.isEmpty(),"Downsampler is empty but shouldn't be");
batchedReads = new ArrayList<SAMRecord>(downsampler.getDownsampledContents());
Assert.assertEquals("Downsampler is returning the wrong number of reads",2,batchedReads.size());
Assert.assertEquals("Downsampler is returning an incorrect read.",reads.get(0),batchedReads.get(0));
Assert.assertEquals("Downsampler is returning an incorrect read.",reads.get(1),batchedReads.get(1));
Assert.assertEquals(batchedReads.size(), 2, "Downsampler is returning the wrong number of reads");
Assert.assertEquals(batchedReads.get(0), reads.get(0), "Downsampler is returning an incorrect read.");
Assert.assertEquals(batchedReads.get(1), reads.get(1), "Downsampler is returning an incorrect read.");
}
}

View File

@ -24,9 +24,9 @@
package org.broadinstitute.sting.utils;
import junit.framework.Assert;
import org.testng.Assert;
import org.broadinstitute.sting.BaseTest;
import org.junit.Test;
import org.testng.annotations.Test;
import java.util.LinkedHashMap;
import java.util.Map;
@ -43,21 +43,21 @@ public class UtilsUnitTest extends BaseTest {
@Test
public void testDupStringNoChars() {
String duped = Utils.dupString('a',0);
Assert.assertEquals("dupString did not produce zero-length string", 0, duped.length());
Assert.assertEquals(duped.length(), 0, "dupString did not produce zero-length string");
}
@Test
public void testDupStringOneChar() {
String duped = Utils.dupString('b',1);
Assert.assertEquals("dupString did not produce single character string", 1, duped.length());
Assert.assertEquals("dupString character was incorrect", 'b', duped.charAt(0));
Assert.assertEquals(duped.length(), 1, "dupString did not produce single character string");
Assert.assertEquals(duped.charAt(0), 'b', "dupString character was incorrect");
}
@Test
public void testDupStringMultiChar() {
String duped = Utils.dupString('c',5);
Assert.assertEquals("dupString did not produce five character string", 5, duped.length());
Assert.assertEquals("dupString string was incorrect", "ccccc", duped);
Assert.assertEquals(duped.length(), 5, "dupString did not produce five character string");
Assert.assertEquals(duped,"ccccc","dupString string was incorrect");
}
@Test

View File

@ -1,11 +1,13 @@
package org.broadinstitute.sting.utils.bed;
import org.broadinstitute.sting.utils.GenomeLocParserTestUtils;
import org.testng.Assert;
import org.broadinstitute.sting.BaseTest;
import org.broadinstitute.sting.utils.GenomeLocParser;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.io.File;
import java.util.List;
@ -19,7 +21,8 @@ public class BedParserUnitTest extends BaseTest {
private File bedFile = new File("testdata/sampleBedFile.bed");
@BeforeClass
public static void beforeTests() {
public void beforeTests() {
GenomeLocParserTestUtils.clearSequenceDictionary();
seq = new IndexedFastaSequenceFile(new File(b36KGReference));
GenomeLocParser.setupRefContigOrdering(seq);
}
@ -28,29 +31,29 @@ public class BedParserUnitTest extends BaseTest {
public void testLoadBedFile() {
BedParser parser = new BedParser(bedFile);
List<GenomeLoc> location = parser.getLocations();
Assert.assertEquals(4, location.size());
Assert.assertEquals(location.size(), 4);
}
@Test
public void testBedParsing() {
BedParser parser = new BedParser(bedFile);
List<GenomeLoc> location = parser.getLocations();
Assert.assertEquals(4, location.size());
Assert.assertEquals(location.size(), 4);
Assert.assertTrue(location.get(0).getContig().equals("20"));
Assert.assertTrue(location.get(1).getContig().equals("20"));
Assert.assertTrue(location.get(2).getContig().equals("22"));
Assert.assertTrue(location.get(3).getContig().equals("22"));
// now check the the start positions
Assert.assertEquals(1, location.get(0).getStart());
Assert.assertEquals(1002, location.get(1).getStart());
Assert.assertEquals(1001, location.get(2).getStart());
Assert.assertEquals(2001, location.get(3).getStart());
Assert.assertEquals(location.get(0).getStart(), 1);
Assert.assertEquals(location.get(1).getStart(), 1002);
Assert.assertEquals(location.get(2).getStart(), 1001);
Assert.assertEquals(location.get(3).getStart(), 2001);
// now check the the stop positions
Assert.assertEquals(999, location.get(0).getStop());
Assert.assertEquals(2000, location.get(1).getStop());
Assert.assertEquals(5000, location.get(2).getStop());
Assert.assertEquals(6000, location.get(3).getStop());
Assert.assertEquals(location.get(0).getStop(), 999);
Assert.assertEquals(location.get(1).getStop(), 2000);
Assert.assertEquals(location.get(2).getStop(), 5000);
Assert.assertEquals(location.get(3).getStop(), 6000);
}
}

View File

@ -29,11 +29,12 @@ package org.broadinstitute.sting.utils.collections;
// the imports for unit testing.
import org.junit.Assert;
import org.junit.Test;
import org.junit.Before;
import org.testng.Assert;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeMethod;
import org.broadinstitute.sting.BaseTest;
import org.broadinstitute.sting.utils.collections.ExpandingArrayList;
import java.util.Arrays;
@ -43,7 +44,7 @@ import java.util.Arrays;
public class ExpandingArrayListUnitTest extends BaseTest {
ExpandingArrayList<Integer> empty, initCap10, hasOne, hasTen;
@Before
@BeforeMethod
public void before() {
empty = new ExpandingArrayList<Integer>();
@ -60,10 +61,10 @@ public class ExpandingArrayListUnitTest extends BaseTest {
public void testBasicSizes() {
logger.warn("Executing testBasicSizes");
Assert.assertEquals(empty.size(), 0);
Assert.assertEquals(initCap10.size(), 0);
Assert.assertEquals(hasOne.size(), 1);
Assert.assertEquals(hasTen.size(), 10);
Assert.assertEquals(0, empty.size());
Assert.assertEquals(0, initCap10.size());
Assert.assertEquals(1, hasOne.size());
Assert.assertEquals(10, hasTen.size());
}
@Test
@ -71,7 +72,7 @@ public class ExpandingArrayListUnitTest extends BaseTest {
logger.warn("Executing testTenElements");
for ( int i = 0; i < 10; i++ ) {
Assert.assertEquals((int)hasTen.get(i), i+1);
Assert.assertEquals(i+1, (int)hasTen.get(i));
}
}
@ -80,12 +81,12 @@ public class ExpandingArrayListUnitTest extends BaseTest {
logger.warn("Executing testSettingTenElements");
for ( int i = 0; i < 10; i++ ) {
Assert.assertEquals((int)hasTen.set(i, 2*i), i+1);
Assert.assertEquals(i+1, (int)hasTen.set(i, 2*i));
}
Assert.assertEquals(hasTen.size(), 10);
Assert.assertEquals(10, hasTen.size());
for ( int i = 0; i < 10; i++ ) {
Assert.assertEquals((int)hasTen.get(i), 2*i);
Assert.assertEquals(2*i, (int)hasTen.get(i));
}
}
@ -93,74 +94,74 @@ public class ExpandingArrayListUnitTest extends BaseTest {
public void testAdd() {
logger.warn("Executing testAdd");
Assert.assertEquals(empty.size(), 0);
Assert.assertEquals(0, empty.size());
empty.add(1);
Assert.assertEquals(empty.size(), 1);
Assert.assertEquals((int)empty.get(0), 1);
Assert.assertEquals(1, empty.size());
Assert.assertEquals(1, (int)empty.get(0));
empty.add(2);
Assert.assertEquals(empty.size(), 2);
Assert.assertEquals((int)empty.get(1), 2);
Assert.assertEquals(2, empty.size());
Assert.assertEquals(2, (int)empty.get(1));
}
@Test
public void testSet1() {
logger.warn("Executing testSet1");
Assert.assertEquals(empty.size(), 0);
Assert.assertEquals(0, empty.size());
empty.set(0, 1);
Assert.assertEquals(empty.size(), 1);
Assert.assertEquals((int)empty.get(0), 1);
Assert.assertEquals(1, empty.size());
Assert.assertEquals(1, (int)empty.get(0));
empty.set(1, 2);
Assert.assertEquals(empty.size(), 2);
Assert.assertEquals((int)empty.get(1), 2);
Assert.assertEquals(2, empty.size());
Assert.assertEquals(2, (int)empty.get(1));
// doesn't expand
empty.set(0, 3);
Assert.assertEquals(empty.size(), 2);
Assert.assertEquals((int)empty.get(0), 3);
Assert.assertEquals(2, empty.size());
Assert.assertEquals(3, (int)empty.get(0));
}
@Test
public void testSetExpanding() {
logger.warn("Executing testSetExpanding");
Assert.assertEquals(empty.size(), 0);
Assert.assertEquals(0, empty.size());
empty.set(3, 1);
Assert.assertEquals(empty.size(), 4);
Assert.assertEquals(4, empty.size());
Assert.assertEquals(empty.get(0), null);
Assert.assertEquals(empty.get(1), null);
Assert.assertEquals(empty.get(2), null);
Assert.assertEquals((int)empty.get(3), 1);
Assert.assertEquals(1, (int)empty.get(3));
}
@Test
public void testSetExpandingReset() {
logger.warn("Executing testSetExpandingReset");
Assert.assertEquals(empty.size(), 0);
Assert.assertEquals(0, empty.size());
empty.set(3, 3);
empty.set(2, 2);
empty.set(1, 1);
empty.set(0, 0);
Assert.assertEquals(empty.size(), 4);
Assert.assertEquals(4, empty.size());
for ( int i = 0; i < 4; i++ )
Assert.assertEquals((int)empty.get(i), i);
Assert.assertEquals(i, (int)empty.get(i));
}
@Test
public void testSetExpandingBig() {
logger.warn("Executing testSetExpandingBig");
Assert.assertEquals(empty.size(), 0);
Assert.assertEquals(0, empty.size());
empty.set(1000, 1000);
Assert.assertEquals(empty.size(), 1001);
Assert.assertEquals(1001, empty.size());
for ( int i = 0; i < 1000; i++ )
Assert.assertEquals(empty.get(i), null);
Assert.assertEquals((int)empty.get(1000), 1000);
Assert.assertEquals(1000, (int)empty.get(1000));
}
@Test (expected=IndexOutOfBoundsException.class )
@Test (expectedExceptions=IndexOutOfBoundsException.class )
public void testSetBadGetNegative() {
logger.warn("Executing testSetBadGetNegative");
empty.get(-1);
@ -171,7 +172,7 @@ public class ExpandingArrayListUnitTest extends BaseTest {
logger.warn("Executing testSetBadGetPost");
empty.set(1, 1);
Assert.assertEquals(empty.get(0), null);
Assert.assertEquals((int)empty.get(1), 1);
Assert.assertEquals(1, (int)empty.get(1));
Assert.assertEquals(empty.get(2), null);
}
}
}

View File

@ -1,8 +1,9 @@
package org.broadinstitute.sting.utils.genotype;
import org.testng.Assert;
import org.broadinstitute.sting.BaseTest;
import org.junit.Assert;
import org.junit.Test;
import org.testng.annotations.Test;
/**

View File

@ -1,11 +1,11 @@
package org.broadinstitute.sting.utils.genotype;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.broadinstitute.sting.BaseTest;
import org.broadinstitute.sting.utils.genotype.LikelihoodObject;
import static junit.framework.Assert.assertTrue;
import static org.testng.Assert.assertTrue;
/*
@ -44,7 +44,7 @@ public class LikelihoodObjectUnitTest extends BaseTest {
private LikelihoodObject mLO = null;
@Before
@BeforeMethod
public void before() {
mLO = new LikelihoodObject();
}

View File

@ -1,8 +1,9 @@
package org.broadinstitute.sting.utils.genotype.glf;
import org.broadinstitute.sting.BaseTest;
import org.junit.Assert;
import org.junit.Test;
import org.testng.Assert;
import org.testng.annotations.Test;
import java.io.File;
import java.util.ArrayList;
@ -46,7 +47,7 @@ public class GLFReaderUnitTest extends BaseTest {
System.err.println("Record count = " + recCount);
e.printStackTrace();
}
Assert.assertEquals(finalRecordCount, recCount);
Assert.assertEquals(contigCount, contigs.size());
Assert.assertEquals(recCount, finalRecordCount);
Assert.assertEquals(contigs.size(), contigCount);
}
}

View File

@ -1,8 +1,9 @@
package org.broadinstitute.sting.utils.genotype.glf;
import org.testng.Assert;
import org.broadinstitute.sting.BaseTest;
import org.junit.Assert;
import org.junit.Test;
import org.testng.annotations.Test;
/**
@ -24,11 +25,11 @@ public class GLFRecordUnitTest extends BaseTest {
GLFRecord rec = new GLFSingleCall("1",'A',1,100,(short)200,likelihoods);
Assert.assertTrue("1".equals(rec.contig));
Assert.assertEquals('A',rec.getRefBase().toChar());
Assert.assertEquals(1,rec.getPosition());
Assert.assertEquals(10,rec.getMinimumLikelihood());
Assert.assertEquals(200,rec.getRmsMapQ());
Assert.assertEquals(100,rec.getReadDepth());
Assert.assertEquals(rec.getRefBase().toChar(), 'A');
Assert.assertEquals(rec.getPosition(), 1);
Assert.assertEquals(rec.getMinimumLikelihood(), 10);
Assert.assertEquals(rec.getRmsMapQ(), 200);
Assert.assertEquals(rec.getReadDepth(), 100);
}

View File

@ -1,13 +1,16 @@
package org.broadinstitute.sting.utils.genotype.glf;
import org.broadinstitute.sting.utils.GenomeLocParserTestUtils;
import org.testng.Assert;
import org.broadinstitute.sting.BaseTest;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.GenomeLocParser;
import org.broadinstitute.sting.utils.genotype.LikelihoodObject;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.io.File;
@ -56,13 +59,14 @@ public class GLFWriterUnitTest extends BaseTest {
protected static final String[] genotypes = {"AA", "AC", "AG", "AT", "CC", "CG", "CT", "GG", "GT", "TT"};
protected final static double SIGNIFICANCE = 5.1;
@Before
@BeforeMethod
public void before() {
}
@BeforeClass
public static void beforeTests() {
public void beforeTests() {
GenomeLocParserTestUtils.clearSequenceDictionary();
IndexedFastaSequenceFile seq;
seq = new IndexedFastaSequenceFile(new File(b36KGReference));
GenomeLocParser.setupRefContigOrdering(seq);
@ -156,6 +160,6 @@ public class GLFWriterUnitTest extends BaseTest {
reader.next();
count++;
}
Assert.assertEquals(count, 100);
Assert.assertEquals(100, count);
}
}
}

View File

@ -1,9 +1,10 @@
package org.broadinstitute.sting.utils.genotype.vcf;
import org.broad.tribble.vcf.*;
import org.testng.Assert;
import org.broadinstitute.sting.BaseTest;
import org.junit.Assert;
import org.junit.Test;
import org.testng.annotations.Test;
import java.io.File;
import java.io.IOException;
@ -26,7 +27,7 @@ public class VCFHeaderUnitTest extends BaseTest {
for (String str : headerStr)
headerFields.add(str);
VCFHeader header = (VCFHeader)codec.createHeader(headerFields,"#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO");
Assert.assertEquals(headerStr.length /* for the # line */,header.getMetaData().size());
Assert.assertEquals(header.getMetaData().size(), headerStr.length /* for the # line */);
return header;
}

View File

@ -6,14 +6,15 @@ import org.broad.tribble.util.variantcontext.Allele;
import org.broad.tribble.util.variantcontext.Genotype;
import org.broad.tribble.util.variantcontext.VariantContext;
import org.broad.tribble.vcf.*;
import org.broadinstitute.sting.utils.GenomeLocParserTestUtils;
import org.testng.Assert;
import org.broadinstitute.sting.BaseTest;
import org.broadinstitute.sting.gatk.refdata.tracks.builders.RMDTrackBuilder;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.GenomeLocParser;
import org.junit.Assert;
import org.junit.Test;
import org.junit.BeforeClass;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeClass;
import java.io.File;
import java.io.FileInputStream;
@ -37,7 +38,8 @@ public class VCFWriterUnitTest extends BaseTest {
private File fakeVCFFile = new File("FAKEVCFFILEFORTESTING.vcf");
@BeforeClass
public static void beforeTests() {
public void beforeTests() {
GenomeLocParserTestUtils.clearSequenceDictionary();
IndexedFastaSequenceFile seq = new IndexedFastaSequenceFile(new File(hg18Reference));
GenomeLocParser.setupRefContigOrdering(seq);
}
@ -76,7 +78,7 @@ public class VCFWriterUnitTest extends BaseTest {
VariantContext vc = (VariantContext)reader.decode(line);
counter++;
}
Assert.assertEquals(2,counter);
Assert.assertEquals(counter, 2);
Tribble.indexFile(fakeVCFFile).delete();
fakeVCFFile.delete();
}
@ -143,12 +145,12 @@ public class VCFWriterUnitTest extends BaseTest {
Assert.assertEquals(VCFHeader.HEADER_FIELDS.values()[index], field);
index++;
}
Assert.assertEquals(metaData.size(), header.getMetaData().size());
Assert.assertEquals(header.getMetaData().size(), metaData.size());
index = 0;
for (String key : header.getGenotypeSamples()) {
Assert.assertTrue(additionalColumns.contains(key));
index++;
}
Assert.assertEquals(additionalColumns.size(), index+1 /* for the header field we don't see */);
Assert.assertEquals(index+1, additionalColumns.size() /* for the header field we don't see */);
}
}

View File

@ -25,10 +25,11 @@
package org.broadinstitute.sting.utils.interval;
import org.testng.Assert;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.broadinstitute.sting.BaseTest;
import org.broadinstitute.sting.utils.GenomeLocParser;
import org.broadinstitute.sting.utils.GenomeLoc;
@ -55,7 +56,7 @@ public class IntervalFileMergingIteratorUnitTest extends BaseTest {
private static List<GenomeLoc> results2 = null;
@BeforeClass
public static void init() {
public void init() {
GenomeLocParser.setupRefContigOrdering(ReferenceSequenceFileFactory.getReferenceSequenceFile(refFile));
results1 = new ArrayList<GenomeLoc>();
@ -84,7 +85,7 @@ public class IntervalFileMergingIteratorUnitTest extends BaseTest {
GenomeLoc l = it.next();
GenomeLoc l_expected = check_it.next();
//System.out.println("int: "+l+" expected: "+l_expected) ;
Assert.assertEquals("Unexpected location returned by the iterator: "+l,l,l_expected);
Assert.assertEquals(l_expected, l, "Unexpected location returned by the iterator: "+l);
}
}
@ -101,7 +102,7 @@ public class IntervalFileMergingIteratorUnitTest extends BaseTest {
// System.out.println("int: "+l+" expected: "+l_expected) ;
}
} catch ( ReviewedStingException e) {
Assert.assertEquals( e.getMessage(), "Interval chr5:7414 in the interval file is out of order.");
Assert.assertEquals("Interval chr5:7414 in the interval file is out of order.", e.getMessage());
}
}
@ -115,7 +116,7 @@ public class IntervalFileMergingIteratorUnitTest extends BaseTest {
GenomeLoc l = it.next();
GenomeLoc l_expected = check_it.next();
// System.out.println("int: "+l+" expected: "+l_expected) ;
Assert.assertEquals("Unexpected location returned by the iterator: "+l,l,l_expected);
Assert.assertEquals(l_expected, l, "Unexpected location returned by the iterator: "+l);
}
}
@ -129,7 +130,7 @@ public class IntervalFileMergingIteratorUnitTest extends BaseTest {
GenomeLoc l = it.next();
GenomeLoc l_expected = check_it.next();
// System.out.println("int: "+l+" expected: "+l_expected) ;
Assert.assertEquals("Unexpected location returned by the iterator: "+l,l,l_expected);
Assert.assertEquals(l_expected, l, "Unexpected location returned by the iterator: "+l);
}
}

View File

@ -25,7 +25,7 @@
package org.broadinstitute.sting.utils.interval;
import org.broadinstitute.sting.WalkerTest;
import org.junit.Test;
import org.testng.annotations.Test;
import java.util.Arrays;
import java.util.Collections;

View File

@ -3,11 +3,12 @@ package org.broadinstitute.sting.utils.interval;
import net.sf.picard.reference.IndexedFastaSequenceFile;
import net.sf.picard.reference.ReferenceSequenceFile;
import org.broadinstitute.sting.BaseTest;
import org.testng.Assert;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.GenomeLocParser;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.io.File;
import java.io.FileNotFoundException;
@ -24,7 +25,7 @@ public class IntervalUtilsTest extends BaseTest {
@BeforeClass
public static void init() throws FileNotFoundException {
public void init() throws FileNotFoundException {
seq = new IndexedFastaSequenceFile(new File(hg18Reference));
GenomeLocParser.setupRefContigOrdering(seq);
@ -45,9 +46,9 @@ public class IntervalUtilsTest extends BaseTest {
}
List<GenomeLoc> ret = IntervalUtils.mergeListsBySetOperator(listEveryTwoFromTwo, listEveryTwoFromOne, IntervalSetRule.UNION);
Assert.assertEquals(100,ret.size());
Assert.assertEquals(ret.size(), 100);
ret = IntervalUtils.mergeListsBySetOperator(listEveryTwoFromTwo, listEveryTwoFromOne, IntervalSetRule.INTERSECTION);
Assert.assertEquals(0,ret.size());
Assert.assertEquals(ret.size(), 0);
}
@Test
@ -64,9 +65,9 @@ public class IntervalUtilsTest extends BaseTest {
}
List<GenomeLoc> ret = IntervalUtils.mergeListsBySetOperator(listEveryTwoFromTwo, allSites, IntervalSetRule.UNION);
Assert.assertEquals(150,ret.size());
Assert.assertEquals(ret.size(), 150);
ret = IntervalUtils.mergeListsBySetOperator(listEveryTwoFromTwo, allSites, IntervalSetRule.INTERSECTION);
Assert.assertEquals(50,ret.size());
Assert.assertEquals(ret.size(), 50);
}
@Test
@ -84,8 +85,8 @@ public class IntervalUtilsTest extends BaseTest {
}
List<GenomeLoc> ret = IntervalUtils.mergeListsBySetOperator(listEveryTwoFromTwo, allSites, IntervalSetRule.UNION);
Assert.assertEquals(40,ret.size());
Assert.assertEquals(ret.size(), 40);
ret = IntervalUtils.mergeListsBySetOperator(listEveryTwoFromTwo, allSites, IntervalSetRule.INTERSECTION);
Assert.assertEquals(20,ret.size());
Assert.assertEquals(ret.size(), 20);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010 The Broad Institute
* Copyright (c) 2010, The Broad Institute
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@ -12,7 +12,6 @@
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@ -28,10 +27,10 @@ package org.broadinstitute.sting.utils.interval;
import org.broadinstitute.sting.BaseTest;
import org.broadinstitute.sting.utils.GenomeLocParser;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.Assert;
import net.sf.picard.reference.ReferenceSequenceFileFactory;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.util.ArrayList;
import java.util.List;
@ -104,7 +103,7 @@ public class NwayIntervalMergingIteratorUnitTest extends BaseTest {
GenomeLoc l = it.next();
GenomeLoc l_expected = e_it.next();
//System.out.println("int: "+l+" expected: "+l_expected) ;
Assert.assertEquals("Unexpected location returned by the iterator: "+l,l,l_expected);
Assert.assertEquals(l,l_expected,"Unexpected location returned by the iterator: "+l);
}
}

View File

@ -27,9 +27,10 @@ package org.broadinstitute.sting.utils.pileup;
import net.sf.samtools.SAMFileHeader;
import net.sf.samtools.SAMReadGroupRecord;
import net.sf.samtools.SAMRecord;
import org.testng.Assert;
import org.broadinstitute.sting.utils.sam.ArtificialSAMUtils;
import org.junit.Assert;
import org.junit.Test;
import org.testng.annotations.Test;
import java.util.Arrays;
import java.util.HashMap;
@ -39,7 +40,7 @@ import java.util.Map;
/**
* Test routines for read-backed pileup.
*/
public class ReadBackedPileupTest {
public class ReadBackedPileupUnitTest {
/**
* Ensure that basic read group splitting works.
*/
@ -73,18 +74,18 @@ public class ReadBackedPileupTest {
ReadBackedPileup rg1Pileup = pileup.getPileupForReadGroup("rg1");
List<SAMRecord> rg1Reads = rg1Pileup.getReads();
Assert.assertEquals("Wrong number of reads in read group rg1",4,rg1Reads.size());
Assert.assertEquals("Read " + read1.getReadName() + " should be in rg1 but isn't",read1,rg1Reads.get(0));
Assert.assertEquals("Read " + read3.getReadName() + " should be in rg1 but isn't",read3,rg1Reads.get(1));
Assert.assertEquals("Read " + read6.getReadName() + " should be in rg1 but isn't",read6,rg1Reads.get(2));
Assert.assertEquals("Read " + read7.getReadName() + " should be in rg1 but isn't",read7,rg1Reads.get(3));
Assert.assertEquals(rg1Reads.size(), 4, "Wrong number of reads in read group rg1");
Assert.assertEquals(rg1Reads.get(0), read1, "Read " + read1.getReadName() + " should be in rg1 but isn't");
Assert.assertEquals(rg1Reads.get(1), read3, "Read " + read3.getReadName() + " should be in rg1 but isn't");
Assert.assertEquals(rg1Reads.get(2), read6, "Read " + read6.getReadName() + " should be in rg1 but isn't");
Assert.assertEquals(rg1Reads.get(3), read7, "Read " + read7.getReadName() + " should be in rg1 but isn't");
ReadBackedPileup rg2Pileup = pileup.getPileupForReadGroup("rg2");
List<SAMRecord> rg2Reads = rg2Pileup.getReads();
Assert.assertEquals("Wrong number of reads in read group rg2",3,rg2Reads.size());
Assert.assertEquals("Read " + read2.getReadName() + " should be in rg2 but isn't",read2,rg2Reads.get(0));
Assert.assertEquals("Read " + read4.getReadName() + " should be in rg2 but isn't",read4,rg2Reads.get(1));
Assert.assertEquals("Read " + read5.getReadName() + " should be in rg2 but isn't",read5,rg2Reads.get(2));
Assert.assertEquals(rg2Reads.size(), 3, "Wrong number of reads in read group rg2");
Assert.assertEquals(rg2Reads.get(0), read2, "Read " + read2.getReadName() + " should be in rg2 but isn't");
Assert.assertEquals(rg2Reads.get(1), read4, "Read " + read4.getReadName() + " should be in rg2 but isn't");
Assert.assertEquals(rg2Reads.get(2), read5, "Read " + read5.getReadName() + " should be in rg2 but isn't");
}
/**
@ -104,13 +105,13 @@ public class ReadBackedPileupTest {
ReadBackedPileup nullRgPileup = pileup.getPileupForReadGroup(null);
List<SAMRecord> nullRgReads = nullRgPileup.getReads();
Assert.assertEquals("Wrong number of reads in null read group",3,nullRgPileup.size());
Assert.assertEquals("Read " + read1.getReadName() + " should be in null rg but isn't",read1,nullRgReads.get(0));
Assert.assertEquals("Read " + read2.getReadName() + " should be in null rg but isn't",read2,nullRgReads.get(1));
Assert.assertEquals("Read " + read3.getReadName() + " should be in null rg but isn't",read3,nullRgReads.get(2));
Assert.assertEquals(nullRgPileup.size(), 3, "Wrong number of reads in null read group");
Assert.assertEquals(nullRgReads.get(0), read1, "Read " + read1.getReadName() + " should be in null rg but isn't");
Assert.assertEquals(nullRgReads.get(1), read2, "Read " + read2.getReadName() + " should be in null rg but isn't");
Assert.assertEquals(nullRgReads.get(2), read3, "Read " + read3.getReadName() + " should be in null rg but isn't");
ReadBackedPileup rg1Pileup = pileup.getPileupForReadGroup("rg1");
Assert.assertNull("Pileup for non-existent read group should return null",rg1Pileup);
Assert.assertNull(rg1Pileup, "Pileup for non-existent read group should return null");
}
/**
@ -151,15 +152,15 @@ public class ReadBackedPileupTest {
ReadBackedPileup rg1Pileup = compositePileup.getPileupForReadGroup("rg1");
List<SAMRecord> rg1Reads = rg1Pileup.getReads();
Assert.assertEquals("Wrong number of reads in read group rg1",2,rg1Reads.size());
Assert.assertEquals("Read " + read1.getReadName() + " should be in rg1 but isn't",read1,rg1Reads.get(0));
Assert.assertEquals("Read " + read3.getReadName() + " should be in rg1 but isn't",read3,rg1Reads.get(1));
Assert.assertEquals(rg1Reads.size(), 2, "Wrong number of reads in read group rg1");
Assert.assertEquals(rg1Reads.get(0), read1, "Read " + read1.getReadName() + " should be in rg1 but isn't");
Assert.assertEquals(rg1Reads.get(1), read3, "Read " + read3.getReadName() + " should be in rg1 but isn't");
ReadBackedPileup rg2Pileup = compositePileup.getPileupForReadGroup("rg2");
List<SAMRecord> rg2Reads = rg2Pileup.getReads();
Assert.assertEquals("Wrong number of reads in read group rg2",2,rg1Reads.size());
Assert.assertEquals("Read " + read2.getReadName() + " should be in rg2 but isn't",read2,rg2Reads.get(0));
Assert.assertEquals("Read " + read4.getReadName() + " should be in rg2 but isn't",read4,rg2Reads.get(1));
Assert.assertEquals(rg1Reads.size(), 2, "Wrong number of reads in read group rg2");
Assert.assertEquals(rg2Reads.get(0), read2, "Read " + read2.getReadName() + " should be in rg2 but isn't");
Assert.assertEquals(rg2Reads.get(1), read4, "Read " + read4.getReadName() + " should be in rg2 but isn't");
}
}

View File

@ -1,11 +1,12 @@
package org.broadinstitute.sting.utils.report;
import org.testng.Assert;
import org.broadinstitute.sting.BaseTest;
import org.broadinstitute.sting.utils.report.tags.Analysis;
import org.broadinstitute.sting.utils.report.tags.DataPoint;
import org.broadinstitute.sting.utils.report.tags.Param;
import org.junit.Assert;
import org.junit.Test;
import org.testng.annotations.Test;
/**
@ -22,7 +23,7 @@ public class AnalysisModuleScannerUnitTest extends BaseTest {
AnalysisModuleScanner scanner = new AnalysisModuleScanner(FakeAnalysis.class);
// check we found one param, and check its description
Assert.assertEquals(3, scanner.getParameters().size());
Assert.assertEquals(scanner.getParameters().size(), 3);
Assert.assertTrue("basic description".equals(scanner.getParameters().values().iterator().next().description()));
// check that the analysis name and description were set

View File

@ -24,7 +24,7 @@
package org.broadinstitute.sting.utils.report;
import org.broadinstitute.sting.BaseTest;
import org.junit.Test;
import org.testng.annotations.Test;
/**

Some files were not shown because too many files have changed in this diff Show More