diff --git a/biodata-formats/src/test/java/org/opencb/biodata/formats/GafParserTest.java b/biodata-formats/src/test/java/org/opencb/biodata/formats/GafParserTest.java index 67c0b0cfa..5e46d4d99 100644 --- a/biodata-formats/src/test/java/org/opencb/biodata/formats/GafParserTest.java +++ b/biodata-formats/src/test/java/org/opencb/biodata/formats/GafParserTest.java @@ -1,12 +1,10 @@ package org.opencb.biodata.formats; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.opencb.biodata.formats.gaf.GafParser; import org.opencb.biodata.models.core.AnnotationEvidence; import org.opencb.biodata.models.core.FeatureOntologyTermAnnotation; -import org.opencb.commons.utils.FileUtils; -import java.io.BufferedReader; import java.io.IOException; import java.nio.file.Path; import java.nio.file.Paths; diff --git a/biodata-formats/src/test/java/org/opencb/biodata/formats/OboFileParserTest.java b/biodata-formats/src/test/java/org/opencb/biodata/formats/OboFileParserTest.java index c709358bc..b8ebf4897 100644 --- a/biodata-formats/src/test/java/org/opencb/biodata/formats/OboFileParserTest.java +++ b/biodata-formats/src/test/java/org/opencb/biodata/formats/OboFileParserTest.java @@ -1,6 +1,6 @@ package org.opencb.biodata.formats; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.opencb.biodata.formats.obo.OboParser; import org.opencb.biodata.models.core.OntologyTerm; import org.opencb.commons.utils.FileUtils; diff --git a/biodata-formats/src/test/java/org/opencb/biodata/formats/alignment/samtools/io/SamtoolsFlagstatsParserTest.java b/biodata-formats/src/test/java/org/opencb/biodata/formats/alignment/samtools/io/SamtoolsFlagstatsParserTest.java index dd74e8dc7..04580a05d 100644 --- a/biodata-formats/src/test/java/org/opencb/biodata/formats/alignment/samtools/io/SamtoolsFlagstatsParserTest.java +++ b/biodata-formats/src/test/java/org/opencb/biodata/formats/alignment/samtools/io/SamtoolsFlagstatsParserTest.java @@ -1,6 +1,6 @@ package org.opencb.biodata.formats.alignment.samtools.io; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.opencb.biodata.formats.alignment.samtools.SamtoolsFlagstats; import java.io.ByteArrayInputStream; diff --git a/biodata-formats/src/test/java/org/opencb/biodata/formats/annotation/io/VepFormatReaderTest.java b/biodata-formats/src/test/java/org/opencb/biodata/formats/annotation/io/VepFormatReaderTest.java index 496d5178a..48e2d2a7d 100644 --- a/biodata-formats/src/test/java/org/opencb/biodata/formats/annotation/io/VepFormatReaderTest.java +++ b/biodata-formats/src/test/java/org/opencb/biodata/formats/annotation/io/VepFormatReaderTest.java @@ -19,8 +19,7 @@ package org.opencb.biodata.formats.annotation.io; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.opencb.biodata.formats.variant.annotation.io.VepFormatReader; import org.opencb.biodata.models.variant.avro.VariantAnnotation; //import org.opencb.biodata.models.variant.annotation.VariantAnnotation; diff --git a/biodata-formats/src/test/java/org/opencb/biodata/formats/feature/gtf/io/GtfReaderTest.java b/biodata-formats/src/test/java/org/opencb/biodata/formats/feature/gtf/io/GtfReaderTest.java index fcb857d93..98bd1acbe 100644 --- a/biodata-formats/src/test/java/org/opencb/biodata/formats/feature/gtf/io/GtfReaderTest.java +++ b/biodata-formats/src/test/java/org/opencb/biodata/formats/feature/gtf/io/GtfReaderTest.java @@ -19,7 +19,7 @@ package org.opencb.biodata.formats.feature.gtf.io; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.opencb.biodata.formats.feature.gtf.Gtf; import java.io.StringReader; diff --git a/biodata-formats/src/test/java/org/opencb/biodata/formats/pedigree/PedigreeParserTest.java b/biodata-formats/src/test/java/org/opencb/biodata/formats/pedigree/PedigreeParserTest.java index 66c397f50..b164c401c 100644 --- a/biodata-formats/src/test/java/org/opencb/biodata/formats/pedigree/PedigreeParserTest.java +++ b/biodata-formats/src/test/java/org/opencb/biodata/formats/pedigree/PedigreeParserTest.java @@ -1,6 +1,6 @@ package org.opencb.biodata.formats.pedigree; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.opencb.biodata.models.clinical.pedigree.Pedigree; import java.nio.file.Path; diff --git a/biodata-formats/src/test/java/org/opencb/biodata/formats/pubmed/PubMedParserTest.java b/biodata-formats/src/test/java/org/opencb/biodata/formats/pubmed/PubMedParserTest.java index 78f1b9c26..7662ac875 100644 --- a/biodata-formats/src/test/java/org/opencb/biodata/formats/pubmed/PubMedParserTest.java +++ b/biodata-formats/src/test/java/org/opencb/biodata/formats/pubmed/PubMedParserTest.java @@ -2,7 +2,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.opencb.biodata.formats.pubmed.v233jaxb.PubmedArticle; import org.opencb.biodata.formats.pubmed.v233jaxb.PubmedArticleSet; diff --git a/biodata-formats/src/test/java/org/opencb/biodata/formats/variant/VariantAggregatedVcfFactoryTest.java b/biodata-formats/src/test/java/org/opencb/biodata/formats/variant/VariantAggregatedVcfFactoryTest.java index 628d430e9..3fa69283f 100644 --- a/biodata-formats/src/test/java/org/opencb/biodata/formats/variant/VariantAggregatedVcfFactoryTest.java +++ b/biodata-formats/src/test/java/org/opencb/biodata/formats/variant/VariantAggregatedVcfFactoryTest.java @@ -16,7 +16,7 @@ package org.opencb.biodata.formats.variant; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.opencb.biodata.formats.variant.vcf4.VariantAggregatedVcfFactory; import org.opencb.biodata.formats.variant.vcf4.VariantVcfFactory; import org.opencb.biodata.models.variant.StudyEntry; diff --git a/biodata-formats/src/test/java/org/opencb/biodata/formats/variant/annotation/io/VepFormatWriterTest.java b/biodata-formats/src/test/java/org/opencb/biodata/formats/variant/annotation/io/VepFormatWriterTest.java index 9092cbec4..503089a91 100644 --- a/biodata-formats/src/test/java/org/opencb/biodata/formats/variant/annotation/io/VepFormatWriterTest.java +++ b/biodata-formats/src/test/java/org/opencb/biodata/formats/variant/annotation/io/VepFormatWriterTest.java @@ -20,7 +20,7 @@ package org.opencb.biodata.formats.variant.annotation.io; import com.fasterxml.jackson.databind.ObjectMapper; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.opencb.biodata.models.variant.Variant; import org.opencb.biodata.models.variant.avro.VariantAvro; import org.opencb.commons.utils.FileUtils; diff --git a/biodata-formats/src/test/java/org/opencb/biodata/formats/variant/clinvar/ClinvarParserTest.java b/biodata-formats/src/test/java/org/opencb/biodata/formats/variant/clinvar/ClinvarParserTest.java index c19730bd1..0a637376a 100644 --- a/biodata-formats/src/test/java/org/opencb/biodata/formats/variant/clinvar/ClinvarParserTest.java +++ b/biodata-formats/src/test/java/org/opencb/biodata/formats/variant/clinvar/ClinvarParserTest.java @@ -19,7 +19,7 @@ package org.opencb.biodata.formats.variant.clinvar; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.opencb.biodata.formats.variant.clinvar.rcv.ClinvarParser; import org.opencb.biodata.formats.variant.clinvar.rcv.v64jaxb.PublicSetType; import org.opencb.biodata.formats.variant.clinvar.rcv.v64jaxb.ReleaseType; diff --git a/biodata-formats/src/test/java/org/opencb/biodata/formats/variant/vcf4/io/VariantVcfReaderTest.java b/biodata-formats/src/test/java/org/opencb/biodata/formats/variant/vcf4/io/VariantVcfReaderTest.java index 5317e552f..b09054fcc 100644 --- a/biodata-formats/src/test/java/org/opencb/biodata/formats/variant/vcf4/io/VariantVcfReaderTest.java +++ b/biodata-formats/src/test/java/org/opencb/biodata/formats/variant/vcf4/io/VariantVcfReaderTest.java @@ -19,7 +19,7 @@ package org.opencb.biodata.formats.variant.vcf4.io; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.opencb.biodata.formats.variant.io.VariantReader; import org.opencb.biodata.models.variant.Variant; import org.opencb.biodata.formats.variant.vcf4.VariantAggregatedVcfFactory; diff --git a/biodata-models/src/test/java/org/opencb/biodata/models/clinical/interpretation/VariantClassificationTest.java b/biodata-models/src/test/java/org/opencb/biodata/models/clinical/interpretation/VariantClassificationTest.java index 5d395405c..67266a2bf 100644 --- a/biodata-models/src/test/java/org/opencb/biodata/models/clinical/interpretation/VariantClassificationTest.java +++ b/biodata-models/src/test/java/org/opencb/biodata/models/clinical/interpretation/VariantClassificationTest.java @@ -1,7 +1,7 @@ package org.opencb.biodata.models.clinical.interpretation; import org.apache.commons.lang3.StringUtils; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.opencb.biodata.models.clinical.ClinicalAcmg; import org.opencb.biodata.models.clinical.ClinicalProperty; diff --git a/biodata-models/src/test/java/org/opencb/biodata/models/core/RegionTest.java b/biodata-models/src/test/java/org/opencb/biodata/models/core/RegionTest.java index 5b3d31038..d64f06334 100644 --- a/biodata-models/src/test/java/org/opencb/biodata/models/core/RegionTest.java +++ b/biodata-models/src/test/java/org/opencb/biodata/models/core/RegionTest.java @@ -1,6 +1,6 @@ package org.opencb.biodata.models.core; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.junit.Assert.assertEquals; diff --git a/biodata-models/src/test/java/org/opencb/biodata/models/feature/GenotypeTest.java b/biodata-models/src/test/java/org/opencb/biodata/models/feature/GenotypeTest.java index d309155d6..1504f30c8 100644 --- a/biodata-models/src/test/java/org/opencb/biodata/models/feature/GenotypeTest.java +++ b/biodata-models/src/test/java/org/opencb/biodata/models/feature/GenotypeTest.java @@ -17,7 +17,8 @@ package org.opencb.biodata.models.feature; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.junit.rules.ExpectedException; import org.opencb.biodata.models.variant.Genotype; @@ -98,23 +99,38 @@ public void testParse() { @Test public void testParseFail1() { - thrown.expect(IllegalArgumentException.class); - thrown.expectMessage("Unknown allele"); - new Genotype("AAA|T", "A", Arrays.asList("G", "C", "T")).getAllelesIdx(); + IllegalArgumentException thrown = Assertions.assertThrows(IllegalArgumentException.class, () -> { + new Genotype("AAA|T", "A", Arrays.asList("G", "C", "T")).getAllelesIdx(); + }); + Assertions.assertEquals("Unable to parse genotype 'AAA|T'. Unknown allele \"AAA\". REF=A,ALT=G,C,T", thrown.getMessage()); } @Test public void testParseFail2() { + /* thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Empty allele"); new Genotype("A|T|", "A", Arrays.asList("G", "C", "T")).getAllelesIdx(); + + */ + + IllegalArgumentException thrown = Assertions.assertThrows(IllegalArgumentException.class, () -> { + new Genotype("A|T|", "A", Arrays.asList("G", "C", "T")).getAllelesIdx(); + + }); + Assertions.assertEquals("Unable to parse genotype 'A|T|'. Empty allele: REF=A,ALT=G,C,T", thrown.getMessage()); } @Test public void testParseFail3() { - thrown.expect(IllegalArgumentException.class); + /* thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Empty allele"); - new Genotype("|C", "A", Arrays.asList("G", "C", "T")).getAllelesIdx(); + new Genotype("|C", "A", Arrays.asList("G", "C", "T")).getAllelesIdx();*/ + + IllegalArgumentException thrown = Assertions.assertThrows(IllegalArgumentException.class, () -> { + new Genotype("|C", "A", Arrays.asList("G", "C", "T")).getAllelesIdx(); + }); + Assertions.assertEquals("Unable to parse genotype '|C'. Empty allele: REF=A,ALT=G,C,T", thrown.getMessage()); } @Test diff --git a/biodata-models/src/test/java/org/opencb/biodata/models/variant/VariantBuilderTest.java b/biodata-models/src/test/java/org/opencb/biodata/models/variant/VariantBuilderTest.java index c3cc61de1..4ccf437a0 100644 --- a/biodata-models/src/test/java/org/opencb/biodata/models/variant/VariantBuilderTest.java +++ b/biodata-models/src/test/java/org/opencb/biodata/models/variant/VariantBuilderTest.java @@ -1,7 +1,8 @@ package org.opencb.biodata.models.variant; import org.apache.commons.lang3.RandomStringUtils; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.opencb.biodata.models.variant.avro.*; import org.opencb.biodata.models.variant.protobuf.VariantProto; @@ -240,14 +241,19 @@ public void buildIndelVariantNoEnd_large() { assertEquals(100 + ref.length() - 1, variant.getEnd().intValue()); } - @Test(expected = IllegalArgumentException.class) + @Test public void buildIncompleteSV() throws Exception { - new VariantBuilder("1:1000:").build(); + IllegalArgumentException thrown = Assertions.assertThrows(IllegalArgumentException.class, () -> { + new VariantBuilder("1:1000:").build(); + }); + } - @Test(expected = IllegalArgumentException.class) + @Test public void buildIncompleteSV_2() throws Exception { - new VariantBuilder("1:1000:A:").build(); + IllegalArgumentException thrown = Assertions.assertThrows(IllegalArgumentException.class, () -> { + new VariantBuilder("1:1000:A:").build(); + }); } diff --git a/biodata-models/src/test/java/org/opencb/biodata/models/variant/VariantTransformToEnsemblFormatTest.java b/biodata-models/src/test/java/org/opencb/biodata/models/variant/VariantTransformToEnsemblFormatTest.java index d9b39bbab..bc7143896 100644 --- a/biodata-models/src/test/java/org/opencb/biodata/models/variant/VariantTransformToEnsemblFormatTest.java +++ b/biodata-models/src/test/java/org/opencb/biodata/models/variant/VariantTransformToEnsemblFormatTest.java @@ -16,7 +16,7 @@ package org.opencb.biodata.models.variant; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.junit.Assert.assertEquals; diff --git a/biodata-models/src/test/java/org/opencb/biodata/models/variant/stats/VariantStatsTest.java b/biodata-models/src/test/java/org/opencb/biodata/models/variant/stats/VariantStatsTest.java index 7ce271a3e..21c3798d5 100644 --- a/biodata-models/src/test/java/org/opencb/biodata/models/variant/stats/VariantStatsTest.java +++ b/biodata-models/src/test/java/org/opencb/biodata/models/variant/stats/VariantStatsTest.java @@ -1,6 +1,6 @@ package org.opencb.biodata.models.variant.stats; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.junit.Assert.*; diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/alignment/BamManagerTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/alignment/BamManagerTest.java index 4fed3c778..ea95855dc 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/alignment/BamManagerTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/alignment/BamManagerTest.java @@ -1,9 +1,10 @@ package org.opencb.biodata.tools.alignment; import htsjdk.samtools.*; -import org.junit.Assume; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Assumptions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.opencb.biodata.models.alignment.RegionCoverage; import org.opencb.biodata.models.core.Region; import org.opencb.biodata.tools.alignment.exceptions.AlignmentCoverageException; @@ -32,9 +33,9 @@ public class BamManagerTest { Path bamPath; Path bwPath; - @Before + @BeforeEach public void init() throws URISyntaxException, IOException { - Assume.assumeTrue(bamCoverageExists()); + Assumptions.assumeTrue(bamCoverageExists()); inputPath = Paths.get(getClass().getResource("/HG00096.chrom20.small.bam").toURI()); bamPath = Paths.get("/tmp/" + inputPath.toFile().getName()); @@ -80,14 +81,14 @@ public void testQuery() throws Exception { AlignmentOptions options = new AlignmentOptions().setLimit(5); Region region = new Region("20", 60000, 65000); List query = bamManager.query(region, options); - assertEquals(5, query.size()); + Assertions.assertEquals(5, query.size()); options.setLimit(3); query = bamManager.query(region, options); for (SAMRecord sam: query) { System.out.println(sam.toString()); } - assertEquals(3, query.size()); + Assertions.assertEquals(3, query.size()); } @Test diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/alignment/converters/SAMRecordToProtoReadAlignmentBiConverterTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/alignment/converters/SAMRecordToProtoReadAlignmentBiConverterTest.java index 387241d8b..cc2d2f4e8 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/alignment/converters/SAMRecordToProtoReadAlignmentBiConverterTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/alignment/converters/SAMRecordToProtoReadAlignmentBiConverterTest.java @@ -2,7 +2,7 @@ import ga4gh.Reads; import htsjdk.samtools.*; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.IOException; import java.net.URISyntaxException; diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/alignment/filters/SamRecordFiltersTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/alignment/filters/SamRecordFiltersTest.java index 335348034..9ccc0b4aa 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/alignment/filters/SamRecordFiltersTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/alignment/filters/SamRecordFiltersTest.java @@ -1,7 +1,7 @@ package org.opencb.biodata.tools.alignment.filters; import htsjdk.samtools.SAMRecord; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.opencb.biodata.models.core.Region; import org.opencb.biodata.tools.alignment.AlignmentOptions; import org.opencb.biodata.tools.alignment.BamManager; diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/alignment/iterators/SAMRecordToProtoReadAlignmentBiConverterTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/alignment/iterators/SAMRecordToProtoReadAlignmentBiConverterTest.java index 132602455..90e1d4bae 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/alignment/iterators/SAMRecordToProtoReadAlignmentBiConverterTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/alignment/iterators/SAMRecordToProtoReadAlignmentBiConverterTest.java @@ -1,7 +1,7 @@ package org.opencb.biodata.tools.alignment.iterators; import htsjdk.samtools.SAMRecord; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.opencb.biodata.models.core.Region; import org.opencb.biodata.tools.alignment.AlignmentOptions; import org.opencb.biodata.tools.alignment.BamManager; diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/alignment/tasks/AlignmentGlobalStatsCalculatorTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/alignment/tasks/AlignmentGlobalStatsCalculatorTest.java index fb8dd326f..be4dd3196 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/alignment/tasks/AlignmentGlobalStatsCalculatorTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/alignment/tasks/AlignmentGlobalStatsCalculatorTest.java @@ -2,7 +2,7 @@ import htsjdk.samtools.SAMRecord; import org.ga4gh.models.ReadAlignment; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.opencb.biodata.tools.alignment.BamManager; import org.opencb.biodata.tools.alignment.AlignmentOptions; import org.opencb.biodata.tools.alignment.iterators.BamIterator; diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/commons/ChunkFrequencyManagerTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/commons/ChunkFrequencyManagerTest.java index ab7af9d15..4f7173ec0 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/commons/ChunkFrequencyManagerTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/commons/ChunkFrequencyManagerTest.java @@ -1,6 +1,6 @@ package org.opencb.biodata.tools.commons; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; import org.opencb.biodata.models.core.Region; import org.opencb.biodata.tools.alignment.BamUtils; import org.opencb.biodata.tools.feature.WigUtils; @@ -19,7 +19,7 @@ public class ChunkFrequencyManagerTest { int chunkSize = 1000; int windowSize = 100; - @Before + @BeforeEach public void init() throws Exception { bamPath = Paths.get(getClass().getResource("/HG00096.chrom20.small.bam").toURI()); coverageWigPath = Paths.get("/tmp/" + bamPath.toFile().getName() + ".bam.coverage.wig"); diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/feature/BigWigManagerTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/feature/BigWigManagerTest.java index 7a683578f..398b84e0e 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/feature/BigWigManagerTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/feature/BigWigManagerTest.java @@ -1,9 +1,8 @@ package org.opencb.biodata.tools.feature; import org.broad.igv.bbfile.*; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.opencb.biodata.models.core.Region; -import org.opencb.biodata.tools.commons.ChunkFrequencyManager; import java.nio.file.Path; import java.nio.file.Paths; diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/pedigree/ModeOfInheritanceTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/pedigree/ModeOfInheritanceTest.java index 5103e37db..bef59158a 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/pedigree/ModeOfInheritanceTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/pedigree/ModeOfInheritanceTest.java @@ -1,7 +1,7 @@ package org.opencb.biodata.tools.pedigree; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.opencb.biodata.models.clinical.Disorder; import org.opencb.biodata.models.clinical.pedigree.Member; import org.opencb.biodata.models.clinical.pedigree.Pedigree; @@ -36,7 +36,7 @@ public class ModeOfInheritanceTest { Disorder disorder3; Disorder disorder4; - @Before + @BeforeEach public void before() { disorder1 = new Disorder("disease1", "disease1", "", "", Collections.emptyList(), Collections.emptyMap()); disorder2 = new Disorder("disease2", "disease2", "", "", Collections.emptyList(), Collections.emptyMap()); diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/sequence/fasta/FastaIndexManagerTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/sequence/fasta/FastaIndexManagerTest.java index 56a0c160f..4a69f2c30 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/sequence/fasta/FastaIndexManagerTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/sequence/fasta/FastaIndexManagerTest.java @@ -16,10 +16,11 @@ package org.opencb.biodata.tools.sequence.fasta; -import org.junit.After; -import org.junit.Before; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; import org.junit.rules.TemporaryFolder; import org.opencb.biodata.tools.sequence.FastaIndexManager; @@ -33,29 +34,24 @@ */ public class FastaIndexManagerTest { - @Rule - public TemporaryFolder testFolder = new TemporaryFolder(); + @TempDir + public File testFolder; private File rocksdb; - @Before + @BeforeEach public void setUp() throws Exception { Path inputPath = Paths.get(getClass().getResource("/homo_sapiens_grch37_small.fa.gz").toURI()); FastaIndexManager fastaIndexManager = new FastaIndexManager(inputPath); - rocksdb = testFolder.newFolder("rocksdb"); + rocksdb = new File(testFolder.getAbsolutePath()+"rocksdb"); + rocksdb.mkdir(); fastaIndexManager.index(inputPath, rocksdb.toPath()); } - @After + @AfterEach public void tearDown() throws Exception { testFolder.delete(); } - // @Test -// public void testIndex() throws Exception { -// Path inputPath = Paths.get(getClass().getResource("/homo_sapiens_grch37_small.fa.gz").toURI()); -// FastaIndexManager fastaIndexManager = new FastaIndexManager(inputPath); -// fastaIndexManager.index(inputPath, Paths.get("/tmp/rocksdb")); -// } @Test public void testQuery() throws Exception { diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/sequence/fasta/FastaIndexTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/sequence/fasta/FastaIndexTest.java index 0924cb72f..584be5be5 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/sequence/fasta/FastaIndexTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/sequence/fasta/FastaIndexTest.java @@ -4,7 +4,8 @@ import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.RandomStringUtils; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.junit.rules.ExpectedException; import org.opencb.biodata.tools.sequence.FastaIndex; import org.opencb.biodata.tools.sequence.SamtoolsFastaIndex; @@ -24,8 +25,6 @@ */ public class FastaIndexTest { - @Rule - public ExpectedException thrown = ExpectedException.none(); @Test public void testIndex() throws Exception { @@ -86,10 +85,11 @@ public void testGenomicSequenceChromosomeNotPresent() throws Exception { ); SequenceAdaptor referenceGenomeReader = new SamtoolsFastaIndex(referenceGenome.toString()); - thrown.expect(SAMException.class); - thrown.expectMessage("Unable to find entry for contig: 1234"); - referenceGenomeReader.query("1234", 1, 1999); + SAMException thrown = Assertions.assertThrows(SAMException.class, () -> { + referenceGenomeReader.query("1234", 1, 1999); + }); + Assertions.assertEquals("Unable to find entry for contig: 1234", thrown.getMessage()); } @Test @@ -101,9 +101,12 @@ public void testGenomicSequenceQueryStartEndOutOfRightBound() throws Exception { SequenceAdaptor referenceGenomeReader = new SamtoolsFastaIndex(referenceGenome.toString()); // Both start & end out of the right bound - thrown.expect(SAMException.class); - thrown.expectMessage("Query asks for data past end of contig"); - referenceGenomeReader.query("1", 600000, 700000); + SAMException thrown = Assertions.assertThrows(SAMException.class, () -> { + referenceGenomeReader.query("1", 600000, 700000); + }); + + Assertions.assertEquals("Query asks for data past end of contig", thrown.getMessage()); + } @Test @@ -114,9 +117,12 @@ public void testGenomicSequenceQueryEndOutOfRightBound() throws Exception { SequenceAdaptor referenceGenomeReader = new SamtoolsFastaIndex(referenceGenome.toString()); // start within the bounds, end out of the right bound. - thrown.expect(SAMException.class); - thrown.expectMessage("Query asks for data past end of contig"); - referenceGenomeReader.query("1", 50000, 700000); + + SAMException thrown = Assertions.assertThrows(SAMException.class, () -> { + referenceGenomeReader.query("1", 50000, 700000); + }); + + Assertions.assertEquals("Query asks for data past end of contig", thrown.getMessage()); } @@ -128,10 +134,11 @@ public void testGenomicSequenceQueryStartOutOfLeftBound() throws Exception { SequenceAdaptor referenceGenomeReader = new SamtoolsFastaIndex(referenceGenome.toString()); // start within the bounds, end out of the right bound. Should return last 10 nts. - thrown.expect(SAMException.class); - thrown.expectMessage("Query asks for data past end of contig"); - referenceGenomeReader.query("1", -1, 700000); + SAMException thrown = Assertions.assertThrows(SAMException.class, () -> { + referenceGenomeReader.query("1", -1, 700000); + }); + Assertions.assertEquals("Query asks for data past end of contig", thrown.getMessage()); } } \ No newline at end of file diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/sequence/fasta/SamtoolsFastaIndexTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/sequence/fasta/SamtoolsFastaIndexTest.java index ea548efef..39231081a 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/sequence/fasta/SamtoolsFastaIndexTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/sequence/fasta/SamtoolsFastaIndexTest.java @@ -2,9 +2,10 @@ import htsjdk.samtools.SAMException; import org.apache.commons.lang3.RandomStringUtils; -import org.junit.BeforeClass; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.junit.rules.ExpectedException; import org.opencb.biodata.tools.sequence.SamtoolsFastaIndex; import org.opencb.biodata.tools.sequence.SequenceAdaptor; @@ -23,10 +24,7 @@ public class SamtoolsFastaIndexTest { private static Path rootDir; private static Path fastaFile; - @Rule - public ExpectedException thrown = ExpectedException.none(); - - @BeforeClass + @BeforeAll public static void setUp() throws Exception { rootDir = Paths.get("target/test-data", "junit-" + RandomStringUtils.randomAlphabetic(5)); Files.createDirectories(rootDir); @@ -76,10 +74,11 @@ public void testGenomicSequenceChromosomeNotPresent() throws Exception { ); SequenceAdaptor referenceGenomeReader = new SamtoolsFastaIndex(referenceGenome.toString()); - thrown.expect(SAMException.class); - thrown.expectMessage("Unable to find entry for contig: 1234"); - referenceGenomeReader.query("1234", 1, 1999); + SAMException thrown = Assertions.assertThrows(SAMException.class, () -> { + referenceGenomeReader.query("1234", 1, 1999); + }); + Assertions.assertEquals("Unable to find entry for contig: 1234", thrown.getMessage()); } @Test @@ -91,9 +90,11 @@ public void testGenomicSequenceQueryStartEndOutOfRightBound() throws Exception { SequenceAdaptor referenceGenomeReader = new SamtoolsFastaIndex(referenceGenome.toString()); // Both start & end out of the right bound - thrown.expect(SAMException.class); - thrown.expectMessage("Query asks for data past end of contig"); - referenceGenomeReader.query("1", 600000, 700000); + SAMException thrown = Assertions.assertThrows(SAMException.class, () -> { + referenceGenomeReader.query("1", 600000, 700000); + }); + + Assertions.assertEquals("Query asks for data past end of contig", thrown.getMessage()); } @Test @@ -104,10 +105,12 @@ public void testGenomicSequenceQueryEndOutOfRightBound() throws Exception { SequenceAdaptor referenceGenomeReader = new SamtoolsFastaIndex(referenceGenome.toString()); // start within the bounds, end out of the right bound. - thrown.expect(SAMException.class); - thrown.expectMessage("Query asks for data past end of contig"); - referenceGenomeReader.query("1", 50000, 700000); + SAMException thrown = Assertions.assertThrows(SAMException.class, () -> { + referenceGenomeReader.query("1", 50000, 700000); + }); + + Assertions.assertEquals("Query asks for data past end of contig", thrown.getMessage()); } @Test @@ -118,9 +121,12 @@ public void testGenomicSequenceQueryStartOutOfLeftBound() throws Exception { SequenceAdaptor referenceGenomeReader = new SamtoolsFastaIndex(referenceGenome.toString()); // start within the bounds, end out of the right bound. Should return last 10 nts. - thrown.expect(SAMException.class); - thrown.expectMessage("Query asks for data past end of contig"); - referenceGenomeReader.query("1", -1, 700000); + + SAMException thrown = Assertions.assertThrows(SAMException.class, () -> { + referenceGenomeReader.query("1", -1, 700000); + }); + + Assertions.assertEquals("Query asks for data past end of contig", thrown.getMessage()); } diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/LeftAlignmentTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/LeftAlignmentTest.java index 89ee0d7e6..eea476915 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/LeftAlignmentTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/LeftAlignmentTest.java @@ -1,7 +1,7 @@ package org.opencb.biodata.tools.variant; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.opencb.biodata.models.variant.Variant; import java.io.IOException; @@ -24,7 +24,7 @@ public class LeftAlignmentTest extends VariantNormalizerGenericTest{ protected Path referenceGenomeCompressed; - @Before + @BeforeEach public void setUp() throws Exception { referenceGenomeUncompressed = Paths.get( diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/VariantDeduplicationTaskTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/VariantDeduplicationTaskTest.java index 41574557c..3f0c4ed15 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/VariantDeduplicationTaskTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/VariantDeduplicationTaskTest.java @@ -1,7 +1,8 @@ package org.opencb.biodata.tools.variant; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.junit.rules.ExpectedException; import org.opencb.biodata.models.variant.Variant; @@ -103,10 +104,13 @@ public void testCircularQueueFull() { l.add(2); l.add(3); l.add(4); - thrown.expect(IllegalStateException.class); - thrown.expectMessage("Queue full"); - l.add(5); + + IllegalStateException thrown = Assertions.assertThrows(IllegalStateException.class, () -> { + l.add(5); + }); + + Assertions.assertEquals("Queue full", thrown.getMessage()); } @Test @@ -117,9 +121,10 @@ public void testCircularAllDuplicated() { l.add(2); l.add(2); l.add(2); - thrown.expect(IllegalStateException.class); - thrown.expectMessage("New element '1' below than any other"); - l.add(1); + IllegalStateException thrown = Assertions.assertThrows(IllegalStateException.class, () -> { + l.add(1); + }); + Assertions.assertEquals("New element '1' below than any other", thrown.getMessage()); } } \ No newline at end of file diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/VariantNormalizerGenericTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/VariantNormalizerGenericTest.java index f097d1e1a..98c47d4f5 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/VariantNormalizerGenericTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/VariantNormalizerGenericTest.java @@ -1,6 +1,6 @@ package org.opencb.biodata.tools.variant; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; import org.junit.Rule; import org.junit.rules.ExpectedException; import org.opencb.biodata.models.variant.Variant; @@ -31,7 +31,7 @@ public class VariantNormalizerGenericTest extends GenericTest { @Rule public ExpectedException thrown = ExpectedException.none(); - @Before + @BeforeEach public void setUp() throws Exception { normalizer = new VariantNormalizer(); normalizer.setGenerateReferenceBlocks(true); diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/VariantNormalizerTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/VariantNormalizerTest.java index 952651906..e872a04ff 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/VariantNormalizerTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/VariantNormalizerTest.java @@ -1,8 +1,8 @@ package org.opencb.biodata.tools.variant; import org.apache.commons.lang3.StringUtils; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.opencb.biodata.models.variant.StudyEntry; import org.opencb.biodata.models.variant.Variant; import org.opencb.biodata.models.variant.avro.*; @@ -276,7 +276,7 @@ public void testNormalizeMultiAllelicMNV() throws NonStandardCompliantSampleFiel } @Test - @Ignore("FIXME: Normalizer should not return duplicated variants") + @Disabled("FIXME: Normalizer should not return duplicated variants") public void testNormalizeMultiAllelicDuplicatedMNV() throws NonStandardCompliantSampleField { normalizer.setDecomposeMNVs(true); normalizer.setGenerateReferenceBlocks(false); @@ -690,7 +690,7 @@ public void testCNVsNormalizationCopyNumber() throws NonStandardCompliantSampleF } @Test - @Ignore + @Disabled // TODO: This should work! public void testCNVsNormalizationCopyNumberMultiSample() throws NonStandardCompliantSampleField { Variant variant; diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/VariantReferenceBlockCreatorTaskTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/VariantReferenceBlockCreatorTaskTest.java index ede891f5b..1dbb14d83 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/VariantReferenceBlockCreatorTaskTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/VariantReferenceBlockCreatorTaskTest.java @@ -1,6 +1,6 @@ package org.opencb.biodata.tools.variant; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.opencb.biodata.models.variant.Variant; import org.opencb.biodata.models.variant.VariantBuilder; import org.opencb.biodata.models.variant.avro.SampleEntry; diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/VariantVcfFactoryTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/VariantVcfFactoryTest.java index d31079088..2d665a1e6 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/VariantVcfFactoryTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/VariantVcfFactoryTest.java @@ -16,16 +16,15 @@ package org.opencb.biodata.tools.variant; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.junit.rules.ExpectedException; import org.opencb.biodata.formats.variant.VariantFactory; import org.opencb.biodata.formats.variant.vcf4.VariantVcfFactory; import org.opencb.biodata.models.variant.StudyEntry; import org.opencb.biodata.models.variant.Variant; import org.opencb.biodata.models.variant.VariantFileMetadata; -import org.opencb.biodata.models.variant.avro.FileEntry; import org.opencb.biodata.models.variant.avro.VariantType; import org.opencb.biodata.models.variant.metadata.VariantStudyMetadata; @@ -48,7 +47,7 @@ public class VariantVcfFactoryTest { @Rule public ExpectedException thrown = ExpectedException.none(); - @Before + @BeforeEach public void setUp() throws Exception { List sampleNames = Arrays.asList("NA001", "NA002", "NA003"); fileMetadata.setSampleIds(sampleNames); diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/VariantVcfHtsjdkReaderTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/VariantVcfHtsjdkReaderTest.java index 4eda2f330..c60ab1056 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/VariantVcfHtsjdkReaderTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/VariantVcfHtsjdkReaderTest.java @@ -1,6 +1,6 @@ package org.opencb.biodata.tools.variant; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.opencb.biodata.models.variant.Variant; import org.opencb.biodata.models.variant.VariantFileMetadata; import org.opencb.biodata.models.variant.avro.SampleEntry; diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/VcfManagerTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/VcfManagerTest.java index 1a4ac4c3f..f26a970d3 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/VcfManagerTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/VcfManagerTest.java @@ -1,7 +1,7 @@ package org.opencb.biodata.tools.variant; import htsjdk.variant.variantcontext.VariantContext; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.opencb.biodata.models.core.Region; import org.opencb.biodata.models.variant.Variant; import org.opencb.biodata.models.variant.protobuf.VariantProto; diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/algorithm/IdentityByDescentClusteringTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/algorithm/IdentityByDescentClusteringTest.java index b9fe41fc6..71ea3e0f1 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/algorithm/IdentityByDescentClusteringTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/algorithm/IdentityByDescentClusteringTest.java @@ -1,12 +1,11 @@ package org.opencb.biodata.tools.variant.algorithm; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.opencb.biodata.formats.variant.vcf4.io.VariantVcfReader; import org.opencb.biodata.models.variant.Variant; import org.opencb.biodata.models.variant.VariantFileMetadata; import org.opencb.biodata.models.variant.metadata.VariantStudyMetadata; import org.opencb.biodata.models.variant.stats.IdentityByDescent; -import org.opencb.biodata.models.variant.stats.IdentityByState; import java.io.*; import java.util.ArrayList; diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/algorithm/IdentityByStateClusteringTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/algorithm/IdentityByStateClusteringTest.java index 2a1e8a59a..fc643f4e2 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/algorithm/IdentityByStateClusteringTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/algorithm/IdentityByStateClusteringTest.java @@ -1,7 +1,7 @@ package org.opencb.biodata.tools.variant.algorithm; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.opencb.biodata.formats.variant.vcf4.io.VariantVcfReader; import org.opencb.biodata.models.variant.Genotype; import org.opencb.biodata.models.variant.Variant; @@ -57,7 +57,7 @@ public void testWrite() throws Exception { // assertIBS(ibsc, ibses, reader); } - @Ignore + @Disabled @Test public void testIBSPerformance() throws Exception { String fileName = "ibs.vcf"; diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/converters/VCFExporterTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/converters/VCFExporterTest.java index 53814be70..821e90f3a 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/converters/VCFExporterTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/converters/VCFExporterTest.java @@ -2,8 +2,8 @@ import htsjdk.variant.variantcontext.writer.Options; import org.apache.commons.lang3.RandomStringUtils; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.opencb.biodata.models.variant.Variant; import org.opencb.biodata.models.variant.VariantFileMetadata; import org.opencb.biodata.models.variant.metadata.VariantStudyMetadata; @@ -18,7 +18,7 @@ public class VCFExporterTest { private Path outPath; - @Before + @BeforeEach public void setUp() throws Exception { outPath = Paths.get("target/test-data", "junit-" + RandomStringUtils.randomAlphabetic(5), "out.vcf"); Files.createDirectories(outPath.getParent()); diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/converters/VariantContextConverterTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/converters/VariantContextConverterTest.java index 942090f10..c1d584e9b 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/converters/VariantContextConverterTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/converters/VariantContextConverterTest.java @@ -1,11 +1,9 @@ package org.opencb.biodata.tools.variant.converters; -import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.Pair; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.opencb.biodata.models.variant.Variant; import org.opencb.biodata.models.variant.avro.AlternateCoordinate; -import org.opencb.biodata.models.variant.avro.FileEntry; import org.opencb.biodata.models.variant.avro.VariantType; import org.opencb.biodata.models.variant.exceptions.NonStandardCompliantSampleField; import org.opencb.biodata.tools.variant.VariantNormalizer; diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/converters/VariantContextToVariantConverterTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/converters/VariantContextToVariantConverterTest.java index b3387d04c..58c32dff0 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/converters/VariantContextToVariantConverterTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/converters/VariantContextToVariantConverterTest.java @@ -28,7 +28,8 @@ import org.apache.avro.specific.SpecificDatumReader; import org.apache.avro.specific.SpecificDatumWriter; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; import org.junit.rules.TemporaryFolder; import org.opencb.biodata.formats.variant.vcf4.FullVcfCodec; import org.opencb.biodata.models.variant.StudyEntry; @@ -60,13 +61,15 @@ */ public class VariantContextToVariantConverterTest { - @Rule - public TemporaryFolder temporaryFolder = new TemporaryFolder(); + @TempDir + public File temporaryFolder; @Test public void testReadVCFFile() throws Exception { Path inputPath = Paths.get(getClass().getResource("/CEU-1409-01_5000.vcf.gz").toURI()); - File folder = temporaryFolder.newFolder(); + File folder = new File(temporaryFolder.getAbsolutePath()); + folder.mkdir(); + // File folder = temporaryFolder.newFolder(); Path outPath = Paths.get(folder.getPath()).resolve("CEU-1409-01_5000.vcf.gz.avro"); writeFile(inputPath, outPath, false); } @@ -213,7 +216,8 @@ private long readFile(Path outPath) throws IOException { @Test public void testRoundTrip() throws Exception { Path inputPath = Paths.get(getClass().getResource("/CEU-1409-01_5000.vcf.gz").toURI()); - File folder = temporaryFolder.newFolder(); + File folder = new File(temporaryFolder.getAbsolutePath()); + folder.mkdir(); Path outPath = Paths.get(folder.getPath()).resolve("CEU-1409-01_5000.vcf.gz.avro"); long cnt = writeFile(inputPath, outPath, false); diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/converters/avro/VariantStatsToPopulationFrequencyConverterTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/converters/avro/VariantStatsToPopulationFrequencyConverterTest.java index f47ddd2cb..80832ec0d 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/converters/avro/VariantStatsToPopulationFrequencyConverterTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/converters/avro/VariantStatsToPopulationFrequencyConverterTest.java @@ -1,11 +1,10 @@ package org.opencb.biodata.tools.variant.converters.avro; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.opencb.biodata.models.variant.avro.PopulationFrequency; import org.opencb.biodata.models.variant.avro.VariantStats; import org.opencb.commons.datastore.core.ObjectMap; -import org.opencb.commons.datastore.core.QueryOptions; import java.util.HashMap; import java.util.Map; @@ -16,7 +15,7 @@ public class VariantStatsToPopulationFrequencyConverterTest { private VariantStatsToPopulationFrequencyConverter converter; - @Before + @BeforeEach public void setUp() throws Exception { converter = new VariantStatsToPopulationFrequencyConverter(); } diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/converters/ga4gh/Ga4ghVariantConverterTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/converters/ga4gh/Ga4ghVariantConverterTest.java index e1fd3e658..eb9f74f0c 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/converters/ga4gh/Ga4ghVariantConverterTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/converters/ga4gh/Ga4ghVariantConverterTest.java @@ -4,8 +4,8 @@ import org.ga4gh.models.CallSet; import org.ga4gh.models.Variant; import org.ga4gh.models.VariantSet; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.opencb.biodata.models.variant.VariantFileMetadata; import org.opencb.biodata.models.variant.metadata.VariantStudyMetadata; import org.opencb.biodata.tools.variant.VariantVcfHtsjdkReader; @@ -27,7 +27,7 @@ public class Ga4ghVariantConverterTest { private List variants; private VariantFileMetadata fileMetadata; - @Before + @BeforeEach public void setUp() throws Exception { variants = Arrays.asList( diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/converters/proto/VariantToVcfRecordTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/converters/proto/VariantToVcfRecordTest.java index 937643aeb..d5497d1e2 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/converters/proto/VariantToVcfRecordTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/converters/proto/VariantToVcfRecordTest.java @@ -12,9 +12,9 @@ import java.util.*; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.opencb.biodata.models.variant.*; import org.opencb.biodata.models.variant.avro.SampleEntry; import org.opencb.biodata.models.variant.protobuf.VcfSliceProtos; @@ -31,7 +31,7 @@ public class VariantToVcfRecordTest { private Variant v_gt; private Variant v; - @Before + @BeforeEach public void setUp() throws Exception { v_gt = Variant.newBuilder("4:1234565-1234568:X:A") .setNames(ids) @@ -59,7 +59,7 @@ public void setUp() throws Exception { .addSample("Sample_0B", "ab2", "ef2", "cd2").build(); } - @After + @AfterEach public void tearDown() throws Exception { } diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/converters/proto/VcfRecordProtoToVariantConverterTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/converters/proto/VcfRecordProtoToVariantConverterTest.java index 9b73ae6b9..6679da2b5 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/converters/proto/VcfRecordProtoToVariantConverterTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/converters/proto/VcfRecordProtoToVariantConverterTest.java @@ -1,7 +1,7 @@ package org.opencb.biodata.tools.variant.converters.proto; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.opencb.biodata.models.variant.*; import org.opencb.biodata.models.variant.avro.FileEntry; import org.opencb.biodata.models.variant.avro.OriginalCall; @@ -25,7 +25,7 @@ public class VcfRecordProtoToVariantConverterTest { private String fileId = "file1"; private String studyId = "study1"; - @Before + @BeforeEach public void setUp() throws Exception { LinkedHashMap samplePositions = new LinkedHashMap<>(); diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/converters/proto/VcfSliceToVariantListConverterTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/converters/proto/VcfSliceToVariantListConverterTest.java index ec6e97f24..630d98317 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/converters/proto/VcfSliceToVariantListConverterTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/converters/proto/VcfSliceToVariantListConverterTest.java @@ -1,8 +1,8 @@ package org.opencb.biodata.tools.variant.converters.proto; import com.google.protobuf.InvalidProtocolBufferException; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.opencb.biodata.models.variant.StudyEntry; import org.opencb.biodata.models.variant.Variant; import org.opencb.biodata.tools.variant.VariantNormalizer; @@ -25,7 +25,7 @@ public class VcfSliceToVariantListConverterTest { private List variants; - @Before + @BeforeEach public void setUp() throws Exception { variants = Arrays.asList( generateVariantWithFormat("1:980:A:.", "PASS", 102f, diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/filters/VariantAvroFiltersTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/filters/VariantAvroFiltersTest.java index 821c30263..eac4808eb 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/filters/VariantAvroFiltersTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/filters/VariantAvroFiltersTest.java @@ -1,7 +1,7 @@ package org.opencb.biodata.tools.variant.filters; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.opencb.biodata.models.variant.Variant; import org.opencb.biodata.models.variant.avro.VariantType; @@ -23,7 +23,7 @@ public class VariantAvroFiltersTest { protected static final String FILE_ID = "file"; private List variants; - @Before + @BeforeEach public void setUp() throws Exception { variants = Arrays.asList( Variant.newBuilder("1:10:A:T") diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/filters/VariantContextFiltersTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/filters/VariantContextFiltersTest.java index 57d667f3e..ed6569e32 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/filters/VariantContextFiltersTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/filters/VariantContextFiltersTest.java @@ -3,7 +3,7 @@ import htsjdk.variant.variantcontext.VariantContext; import htsjdk.variant.vcf.VCFFileReader; import htsjdk.variant.vcf.VCFHeader; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.nio.file.Path; import java.nio.file.Paths; diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/merge/VariantAlternateRearrangerTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/merge/VariantAlternateRearrangerTest.java index cbe2b335f..1313639f4 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/merge/VariantAlternateRearrangerTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/merge/VariantAlternateRearrangerTest.java @@ -1,6 +1,6 @@ package org.opencb.biodata.tools.variant.merge; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.opencb.biodata.models.variant.Genotype; import java.util.Arrays; diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/merge/VariantMergerTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/merge/VariantMergerTest.java index 46ab5800e..20af74e72 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/merge/VariantMergerTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/merge/VariantMergerTest.java @@ -2,10 +2,11 @@ import htsjdk.variant.vcf.VCFConstants; import org.apache.commons.lang3.StringUtils; -import org.junit.After; -import org.junit.Before; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.junit.rules.ExpectedException; import org.opencb.biodata.models.variant.Genotype; import org.opencb.biodata.models.variant.StudyEntry; @@ -30,10 +31,7 @@ public class VariantMergerTest { private VariantMerger variantMergerCollapse; private Variant var; - @Rule - public ExpectedException thrown = ExpectedException.none(); - - @Before + @BeforeEach public void setUp() throws Exception { variantMerger = new VariantMerger(); variantMergerCollapse = new VariantMerger(true); @@ -43,7 +41,7 @@ public void setUp() throws Exception { variantMerger.merge(var, tempate); } - @After + @AfterEach public void tearDown() throws Exception { } @@ -419,10 +417,16 @@ public void testEqualsVariantAltSecAlt() { @Test public void testValidateEmptyFields() { - thrown.expect(IllegalStateException.class); - Variant v = new Variant("1:1050:CTTTC:-"); - AlternateCoordinate a1 = new AlternateCoordinate(null, 1050, null, "C", "T", VariantType.SNV); - variantMerger.validateAlternate(a1); + IllegalStateException thrown = Assertions.assertThrows(IllegalStateException.class, () -> { + Variant v = new Variant("1:1050:CTTTC:-"); + AlternateCoordinate a1 = new AlternateCoordinate(null, 1050, null, "C", "T", VariantType.SNV); + variantMerger.validateAlternate(a1); + + }); + + Assertions.assertEquals("Chromosome of alt is null: {\"chromosome\": null, \"start\": 1050, \"end\": null, \"reference\": \"C\", \"alternate\": \"T\", \"type\": \"SNV\"}", thrown.getMessage()); + + } @Test @@ -512,7 +516,6 @@ public void testMergeIndelCase1() throws NonStandardCompliantSampleField { @Test public void testMergeIndelOverlapping() throws NonStandardCompliantSampleField { - thrown.expect(IllegalStateException.class); Variant v1 = VariantTestUtils.generateVariantWithFormat("1:10:TACACACACAC:TACACAC", VCFConstants.GENOTYPE_KEY + "," + VCFConstants.GENOTYPE_FILTER_KEY, "S1", "1/2","PASS"); @@ -538,8 +541,14 @@ public void testMergeIndelOverlapping() throws NonStandardCompliantSampleField { variants.stream().forEach(v -> System.out.println("v.toJson() = " + v.toJson())); // Fails down to normalization producing two variants with same GT (1/2 and 2/1) - Variant mergeVar = variantMerger.merge(v2, variants); - System.out.println("mergeVar = " + mergeVar.toJson()); + IllegalStateException thrown = Assertions.assertThrows(IllegalStateException.class, () -> { + Variant mergeVar = variantMerger.merge(v2, variants); + System.out.println("mergeVar = " + mergeVar.toJson()); + }); + + Assertions.assertEquals("Current variant can't be a NO_VARIANT", thrown.getMessage()); + + } @Test @@ -792,9 +801,11 @@ public void testMergeOverlap_IN_SNP_MultiSampleAndRepeatSample() { @Test public void testMergeOverlap_IN_SNP_FAIL() { - thrown.expect(AssertionError.class); // Should only be merged once - before the inserted gap. - checkOverlapNoSecondaries("1:10::AT", "1:10:A:G"); + AssertionError thrown = Assertions.assertThrows(AssertionError.class, () -> { + checkOverlapNoSecondaries("1:10::AT", "1:10:A:G"); + }); + } @Test @@ -804,9 +815,12 @@ public void testMergeOverlap_SNP_IN() { @Test public void testMergeOverlap_SNP_IN_FAIL() { - thrown.expect(AssertionError.class); + // Should only be merged once - before the inserted gap. - checkOverlapNoSecondaries("1:10:A:G", "1:10::AT"); + + AssertionError thrown = Assertions.assertThrows(AssertionError.class, () -> { + checkOverlapNoSecondaries("1:10:A:G", "1:10::AT"); + }); } // @Test @@ -923,8 +937,12 @@ public void testUseWrongFormat() { variantMerger.setExpectedFormats(Arrays.asList("GT")); variantMerger.setExpectedFormats(Arrays.asList("DP")); variantMerger.setExpectedFormats(Arrays.asList("GT", "DP")); - thrown.expect(IllegalArgumentException.class); - variantMerger.setExpectedFormats(Arrays.asList("DP", "GT")); + + IllegalArgumentException thrown = Assertions.assertThrows(IllegalArgumentException.class, () -> { + variantMerger.setExpectedFormats(Arrays.asList("DP", "GT")); + }); + + Assertions.assertEquals("Genotype format field [GT] must be in the first position!", thrown.getMessage()); } @Test @@ -1006,12 +1024,20 @@ public void testMergeSnpBlock() { @Test public void testMergeSameSampleSameVariant() { // TODO check if this can happen and result is correct !!! - thrown.expect(IllegalStateException.class); - variantMerger.merge(var, VariantTestUtils.generateVariant("1:10:A:T", "S01", "0/1")); - StudyEntry se = variantMerger.getStudy(var); - assertEquals(1, se.getSecondaryAlternates().size()); + + IllegalStateException thrown = Assertions.assertThrows(IllegalStateException.class, () -> { + variantMerger.merge(var, VariantTestUtils.generateVariant("1:10:A:T", "S01", "0/1")); + StudyEntry se = variantMerger.getStudy(var); + assertEquals(1, se.getSecondaryAlternates().size()); // // TODO not sure 1/2 is correct if the same individual has a variant with 0/1 and another variant with 0/2 overlapping each other - assertEquals("0/1,0/2", se.getSamples().get(0).getData().get(0)); + assertEquals("0/1,0/2", se.getSamples().get(0).getData().get(0)); + }); + + Assertions.assertEquals("Duplicated entries during merging: Issue with ID S01; Variants: \n" + + "{\"chromosome\": \"1\", \"start\": 10, \"end\": 10, \"reference\": \"A\", \"alternate\": \"T\", \"type\": \"SNV\"};", thrown.getMessage()); + + + } @Test diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/metadata/VariantMetadataManagerTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/metadata/VariantMetadataManagerTest.java index eaf11dd5a..de4de4a65 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/metadata/VariantMetadataManagerTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/metadata/VariantMetadataManagerTest.java @@ -1,13 +1,12 @@ package org.opencb.biodata.tools.variant.metadata; import org.apache.commons.collections4.map.HashedMap; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.opencb.biodata.models.metadata.Individual; import org.opencb.biodata.models.metadata.Sample; import org.opencb.biodata.models.variant.metadata.VariantMetadata; import org.opencb.biodata.models.variant.metadata.VariantStudyMetadata; -import org.opencb.biodata.tools.variant.metadata.VariantMetadataManager; import org.opencb.commons.datastore.core.Query; import java.io.IOException; @@ -27,7 +26,7 @@ public class VariantMetadataManagerTest { private VariantMetadataManager manager; private VariantMetadata variantMetadata; - @Before + @BeforeEach public void setUp() throws Exception { variantMetadata = createMetadata(); manager = new VariantMetadataManager(); diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/metadata/VariantMetadataUtilsTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/metadata/VariantMetadataUtilsTest.java index 6b4d3f197..454e4232c 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/metadata/VariantMetadataUtilsTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/metadata/VariantMetadataUtilsTest.java @@ -1,13 +1,12 @@ package org.opencb.biodata.tools.variant.metadata; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.opencb.biodata.models.variant.Variant; import org.opencb.biodata.models.variant.VariantFileMetadata; import org.opencb.biodata.tools.variant.VariantVcfHtsjdkReader; import java.io.IOException; import java.io.InputStream; -import java.nio.file.Paths; import java.util.Arrays; import static org.junit.Assert.*; diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/normalizer/extensions/VafVariantNormalizerExtensionTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/normalizer/extensions/VafVariantNormalizerExtensionTest.java index 38a89d1c6..afc357ab3 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/normalizer/extensions/VafVariantNormalizerExtensionTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/normalizer/extensions/VafVariantNormalizerExtensionTest.java @@ -1,7 +1,7 @@ package org.opencb.biodata.tools.variant.normalizer.extensions; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.opencb.biodata.models.variant.Variant; import org.opencb.biodata.models.variant.VariantFileMetadata; import org.opencb.biodata.models.variant.metadata.VariantFileHeader; @@ -22,7 +22,7 @@ public class VafVariantNormalizerExtensionTest { private List singleSample; private List multiSample; - @Before + @BeforeEach public void setUp() throws Exception { singleSample = Collections.singletonList("SAMPLE_1"); multiSample = Arrays.asList("SAMPLE_1", "SAMPLE_2", "SAMPLE_3"); diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/scores/HardyWeinbergScoreCalculatorTaskTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/scores/HardyWeinbergScoreCalculatorTaskTest.java index 5f7030560..43432067f 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/scores/HardyWeinbergScoreCalculatorTaskTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/scores/HardyWeinbergScoreCalculatorTaskTest.java @@ -1,6 +1,6 @@ package org.opencb.biodata.tools.variant.scores; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.opencb.biodata.models.variant.Genotype; import org.opencb.biodata.models.variant.Variant; import org.opencb.biodata.models.variant.VariantBuilder; diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/simulator/VariantSimulatorTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/simulator/VariantSimulatorTest.java index 9b0c0df64..f3b80b554 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/simulator/VariantSimulatorTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/simulator/VariantSimulatorTest.java @@ -16,11 +16,9 @@ package org.opencb.biodata.tools.variant.simulator; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.opencb.biodata.models.variant.Variant; -import static org.junit.Assert.*; - /** * Created by imedina on 27/10/15. */ diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/stats/SampleVariantStatsCalculatorTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/stats/SampleVariantStatsCalculatorTest.java index 99371118f..aa88d2d23 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/stats/SampleVariantStatsCalculatorTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/stats/SampleVariantStatsCalculatorTest.java @@ -2,8 +2,8 @@ import htsjdk.variant.vcf.VCFHeader; import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.opencb.biodata.formats.variant.io.VariantReader; import org.opencb.biodata.models.clinical.pedigree.Member; import org.opencb.biodata.models.clinical.pedigree.Pedigree; @@ -29,7 +29,7 @@ public class SampleVariantStatsCalculatorTest { private Pedigree pedigree; private List samples; - @Before + @BeforeEach public void setUp() throws Exception { samples = Arrays.asList( "s0", "s1", "s2", "s3", "s4", "s5"); variants = Arrays.asList( diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/stats/VariantAggregatedEVSStatsCalculatorTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/stats/VariantAggregatedEVSStatsCalculatorTest.java index c8589a4e9..b40fcf372 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/stats/VariantAggregatedEVSStatsCalculatorTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/stats/VariantAggregatedEVSStatsCalculatorTest.java @@ -16,10 +16,9 @@ package org.opencb.biodata.tools.variant.stats; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.opencb.biodata.formats.variant.VariantFactory; import org.opencb.biodata.formats.variant.vcf4.VariantAggregatedVcfFactory; -import org.opencb.biodata.models.variant.Genotype; import org.opencb.biodata.models.variant.StudyEntry; import org.opencb.biodata.models.variant.Variant; import org.opencb.biodata.models.variant.VariantFileMetadata; diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/stats/VariantAggregatedExacStatsCalculatorTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/stats/VariantAggregatedExacStatsCalculatorTest.java index 79967472d..a793b5006 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/stats/VariantAggregatedExacStatsCalculatorTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/stats/VariantAggregatedExacStatsCalculatorTest.java @@ -18,8 +18,8 @@ import htsjdk.variant.vcf.VCFHeaderLineCount; import htsjdk.variant.vcf.VCFHeaderLineType; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.opencb.biodata.formats.variant.VariantFactory; import org.opencb.biodata.formats.variant.vcf4.VariantAggregatedVcfFactory; import org.opencb.biodata.models.variant.StudyEntry; @@ -50,7 +50,7 @@ public class VariantAggregatedExacStatsCalculatorTest extends GenericTest { private VariantFactory factory = new VariantAggregatedVcfFactory(); private VariantNormalizer normalizer = new VariantNormalizer(); - @Before + @BeforeEach public void setUp() throws Exception { normalizer.configure("AC_Hom", VCFHeaderLineCount.A, VCFHeaderLineType.Integer); // normalizer.configure("AC_Het", VCFHeaderLineCount.A, VCFHeaderLineType.Integer); diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/stats/VariantAggregatedStatsCalculatorTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/stats/VariantAggregatedStatsCalculatorTest.java index 34978c56e..44aba457c 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/stats/VariantAggregatedStatsCalculatorTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/stats/VariantAggregatedStatsCalculatorTest.java @@ -1,8 +1,7 @@ package org.opencb.biodata.tools.variant.stats; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.opencb.biodata.formats.variant.vcf4.VariantAggregatedVcfFactory; -import org.opencb.biodata.models.variant.Genotype; import org.opencb.biodata.models.variant.StudyEntry; import org.opencb.biodata.models.variant.Variant; import org.opencb.biodata.models.variant.VariantFileMetadata; diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/stats/VariantSetStatsCalculatorTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/stats/VariantSetStatsCalculatorTest.java index 88efd268a..bfd0bd3a3 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/stats/VariantSetStatsCalculatorTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/stats/VariantSetStatsCalculatorTest.java @@ -1,7 +1,7 @@ package org.opencb.biodata.tools.variant.stats; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.opencb.biodata.formats.variant.io.VariantReader; import org.opencb.biodata.models.variant.StudyEntry; import org.opencb.biodata.models.variant.Variant; @@ -38,7 +38,7 @@ public class VariantSetStatsCalculatorTest { private int variants = 4; private double passVariants = 3/4f; - @Before + @BeforeEach public void setUp() throws Exception { List variants = new ArrayList<>(); VariantFileHeader header = new VariantFileHeader(); diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/stats/VariantStatsCalculatorTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/stats/VariantStatsCalculatorTest.java index d540f0139..927cbf768 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/stats/VariantStatsCalculatorTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/stats/VariantStatsCalculatorTest.java @@ -16,7 +16,7 @@ package org.opencb.biodata.tools.variant.stats; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.opencb.biodata.formats.variant.vcf4.VariantVcfFactory; import org.opencb.biodata.models.variant.Genotype; import org.opencb.biodata.models.variant.StudyEntry; diff --git a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/stats/writer/VariantStatsTsvExporterTest.java b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/stats/writer/VariantStatsTsvExporterTest.java index f0bf199db..46371cca6 100644 --- a/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/stats/writer/VariantStatsTsvExporterTest.java +++ b/biodata-tools/src/test/java/org/opencb/biodata/tools/variant/stats/writer/VariantStatsTsvExporterTest.java @@ -1,7 +1,7 @@ package org.opencb.biodata.tools.variant.stats.writer; import org.apache.commons.lang3.RandomUtils; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.opencb.biodata.models.variant.StudyEntry; import org.opencb.biodata.models.variant.Variant; import org.opencb.biodata.models.variant.VariantTestUtils;