Skip to content

Commit 92adddc

Browse files
author
Sergey Pyatykh
committed
Finish biojava-genome JUnit 5 migration and drop junit-addons
Replace FileAssert and leftover JUnit 4 APIs so genome tests compile without junit-addons.
1 parent 148bbb5 commit 92adddc

4 files changed

Lines changed: 10 additions & 32 deletions

File tree

‎biojava-genome/pom.xml‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -82,22 +82,6 @@
8282
<version>7.2.7-SNAPSHOT</version>
8383
<scope>compile</scope>
8484
</dependency>
85-
<dependency>
86-
<groupId>junit-addons</groupId>
87-
<artifactId>junit-addons</artifactId>
88-
<version>1.4</version>
89-
<scope>test</scope>
90-
<exclusions>
91-
<exclusion>
92-
<groupId>xerces</groupId>
93-
<artifactId>xmlParserAPIs</artifactId>
94-
</exclusion>
95-
<exclusion>
96-
<groupId>xerces</groupId>
97-
<artifactId>xercesImpl</artifactId>
98-
</exclusion>
99-
</exclusions>
100-
</dependency>
10185
<!-- logging dependencies (managed by parent pom, don't set versions or scopes here) -->
10286
<dependency>
10387
<groupId>org.slf4j</groupId>

‎biojava-genome/src/test/java/org/biojava/nbio/genome/GeneFeatureHelperTest.java‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
*/
2121
package org.biojava.nbio.genome;
2222

23-
import junitx.framework.FileAssert;
2423
import org.biojava.nbio.genome.parsers.gff.FeatureList;
2524
import org.biojava.nbio.genome.parsers.gff.GFF3Reader;
2625
import org.biojava.nbio.genome.parsers.gff.GFF3Writer;
@@ -29,6 +28,7 @@
2928
import org.biojava.nbio.core.sequence.ProteinSequence;
3029
import org.biojava.nbio.core.sequence.io.FastaWriterHelper;
3130
import org.junit.jupiter.api.AfterEach;
31+
import org.junit.jupiter.api.Assertions;
3232
import org.junit.jupiter.api.BeforeEach;
3333
import org.junit.jupiter.api.Test;
3434
import org.slf4j.Logger;
@@ -100,8 +100,10 @@ void testOutputFastaSequenceLengthGFF3() throws Exception {
100100
File gffFile = Files.createTempFile("volvox_length","gff3").toFile();
101101
gffFile.deleteOnExit();
102102
GeneFeatureHelper.outputFastaSequenceLengthGFF3(fastaSequenceFile, gffFile);
103-
FileAssert.assertEquals("volvox_length.gff3 and volvox_length_output.gff3 are not equal", gffFile,
104-
new File("src/test/resources/volvox_length_reference.gff3"));
103+
Assertions.assertEquals(
104+
Files.readString(new File("src/test/resources/volvox_length_reference.gff3").toPath()),
105+
Files.readString(gffFile.toPath()),
106+
"volvox_length.gff3 and volvox_length_output.gff3 are not equal");
105107

106108
}
107109

@@ -140,8 +142,10 @@ void testGetProteinSequences() throws Exception {
140142
File tmp = Files.createTempFile("volvox_all","faa").toFile();
141143
tmp.deleteOnExit();
142144
FastaWriterHelper.writeProteinSequence(tmp, proteinSequenceList.values());
143-
FileAssert.assertEquals("volvox_all_reference.faa and volvox_all.faa are not equal", new File(
144-
"src/test/resources/volvox_all_reference.faa"), tmp);
145+
Assertions.assertEquals(
146+
Files.readString(new File("src/test/resources/volvox_all_reference.faa").toPath()),
147+
Files.readString(tmp.toPath()),
148+
"volvox_all_reference.faa and volvox_all.faa are not equal");
145149
}
146150

147151
/**

‎biojava-genome/src/test/java/org/biojava/nbio/genome/TestChromosomeMappingTools.java‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
import java.util.Arrays;
2929
import java.util.List;
3030

31-
import static org.junit.Assert.assertEquals;
32-
3331
/**
3432
* Created by Yana Valasatava on 8/14/17.
3533
*/

‎biojava-genome/src/test/java/org/biojava/nbio/genome/io/fastq/FastqTest.java‎

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,9 @@
2020
*/
2121
package org.biojava.nbio.genome.io.fastq;
2222

23-
import org.junit.Assert;
2423
import org.junit.jupiter.api.Assertions;
2524
import org.junit.jupiter.api.Test;
2625

27-
import org.junit.function.ThrowingRunnable;
28-
2926
/**
3027
* Unit test for Fastq.
3128
*/
@@ -116,12 +113,7 @@ void testBuilder()
116113
@Test
117114
void testBuilderNullFastq()
118115
{
119-
Assert.assertThrows(IllegalArgumentException.class, new ThrowingRunnable() {
120-
@Override
121-
public void run() {
122-
Fastq.builder(null);
123-
}
124-
});
116+
Assertions.assertThrows(IllegalArgumentException.class, () -> Fastq.builder(null));
125117
}
126118

127119
@Test

0 commit comments

Comments
 (0)