Skip to content

Commit 1458d85

Browse files
committed
Converting junit3 to 4, thanks intellij
1 parent 4d363fb commit 1458d85

File tree

65 files changed

+1384
-1239
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+1384
-1239
lines changed

biojava-alignment/src/test/java/org/biojava/nbio/alignment/TestDNAAlignment.java

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
package org.biojava.nbio.alignment;
2525

2626
import org.biojava.nbio.core.alignment.matrices.SubstitutionMatrixHelper;
27-
import junit.framework.TestCase;
2827
import org.biojava.nbio.alignment.Alignments.PairwiseSequenceAlignerType;
2928
import org.biojava.nbio.alignment.template.PairwiseSequenceAligner;
3029
import org.biojava.nbio.core.alignment.template.Profile;
@@ -37,35 +36,38 @@
3736
import org.biojava.nbio.core.sequence.compound.NucleotideCompound;
3837
import org.biojava.nbio.core.sequence.io.FastaReaderHelper;
3938
import org.biojava.nbio.core.util.ConcurrencyTools;
39+
import org.junit.Assert;
40+
import org.junit.Test;
4041

4142
import java.io.InputStream;
4243
import java.util.ArrayList;
4344
import java.util.LinkedHashMap;
4445
import java.util.List;
4546

46-
public class TestDNAAlignment extends TestCase {
47+
public class TestDNAAlignment {
4748

4849
private static final double PRECISION = 0.00000001;
4950

5051

52+
@Test
5153
public void testDNAAlignment() {
5254

5355
try {
5456
List<DNASequence> lst = getDNAFASTAFile();
5557

5658
Profile<DNASequence, NucleotideCompound> profile = Alignments.getMultipleSequenceAlignment(lst);
5759

58-
assertTrue(profile.getSize() == 10);
60+
Assert.assertTrue(profile.getSize() == 10);
5961

60-
assertTrue(profile.getAlignedSequence(1).getSequenceAsString().length() > 50);
62+
Assert.assertTrue(profile.getAlignedSequence(1).getSequenceAsString().length() > 50);
6163

6264

6365
// here how to print the MSA:
6466

6567
//System.out.printf("MSA:%n%s%n", profile);
6668
} catch (Exception e) {
6769
e.printStackTrace();
68-
fail(e.getMessage());
70+
Assert.fail(e.getMessage());
6971
}
7072
ConcurrencyTools.shutdown();
7173
}
@@ -88,6 +90,7 @@ private static List<DNASequence> getDNAFASTAFile() throws Exception {
8890
/**
8991
* @author brandstaetter
9092
*/
93+
@Test
9194
public void testDNAMultipleAlignmentWithMixedCompoundSets() throws CompoundNotFoundException {
9295

9396
DNASequence target = new DNASequence("ACTGACGTGTAGCTGACTGA", DNACompoundSet.getDNACompoundSet());
@@ -100,7 +103,7 @@ public void testDNAMultipleAlignmentWithMixedCompoundSets() throws CompoundNotFo
100103
try {
101104
@SuppressWarnings("unused")
102105
Profile<DNASequence, NucleotideCompound> profile = Alignments.getMultipleSequenceAlignment(lst);
103-
fail("Alignments.getMultipleSequenceAlignment(lst) expected exception with differing compound sets");
106+
Assert.fail("Alignments.getMultipleSequenceAlignment(lst) expected exception with differing compound sets");
104107
} catch (IllegalArgumentException ex) {
105108
// expected exception
106109
}
@@ -109,6 +112,7 @@ public void testDNAMultipleAlignmentWithMixedCompoundSets() throws CompoundNotFo
109112
/**
110113
* @author brandstaetter
111114
*/
115+
@Test
112116
public void testDNAPairwiseAlignmentWithMixedCompoundSets() throws CompoundNotFoundException {
113117
DNASequence target = new DNASequence("ACTGACGTGTAGCTGACTGA", DNACompoundSet.getDNACompoundSet());
114118
DNASequence query = new DNASequence("ACTGACGTGTAGCTGACTGT", AmbiguityDNACompoundSet.getDNACompoundSet());
@@ -120,42 +124,45 @@ public void testDNAPairwiseAlignmentWithMixedCompoundSets() throws CompoundNotFo
120124
try {
121125
@SuppressWarnings("unused")
122126
SequencePair<DNASequence, NucleotideCompound> psa = Alignments.getPairwiseAlignment(query, target, PairwiseSequenceAlignerType.LOCAL, gapP, matrix);
123-
fail("Alignments.getPairwiseAlignment() expected exception with differing compound sets");
127+
Assert.fail("Alignments.getPairwiseAlignment() expected exception with differing compound sets");
124128
} catch (IllegalArgumentException ex) {
125129
// expected exception
126130
}
127131
}
128132
/**
129133
* @author Daniel Cameron
130134
*/
135+
@Test
131136
public void testMixedCaseInputStringsMatchUnderlyingBases() throws CompoundNotFoundException {
132137
DNASequence target = new DNASequence("AAAAAAAAGTC", DNACompoundSet.getDNACompoundSet());
133138
DNASequence query = new DNASequence("aaaaaaaagtc", DNACompoundSet.getDNACompoundSet());
134139
SubstitutionMatrix<NucleotideCompound> matrix = SubstitutionMatrixHelper.getNuc4_4();
135140
SimpleGapPenalty gapP = new SimpleGapPenalty((short)5, (short)2);
136141
// should be a full match with +5 per match
137-
assertEquals(5.0 * query.getLength(), Alignments.getPairwiseAligner(query, target, PairwiseSequenceAlignerType.LOCAL, gapP, matrix).getScore(), PRECISION);
142+
Assert.assertEquals(5.0 * query.getLength(), Alignments.getPairwiseAligner(query, target, PairwiseSequenceAlignerType.LOCAL, gapP, matrix).getScore(), PRECISION);
138143
}
139144
/**
140145
* @author Daniel Cameron
141146
*/
147+
@Test
142148
public void testNoAlignedBases() throws CompoundNotFoundException {
143149
DNASequence target = new DNASequence("A", DNACompoundSet.getDNACompoundSet());
144150
DNASequence query = new DNASequence("T", DNACompoundSet.getDNACompoundSet());
145151
SubstitutionMatrix<NucleotideCompound> matrix = SubstitutionMatrixHelper.getNuc4_4();
146152
SimpleGapPenalty gapP = new SimpleGapPenalty((short)0, (short)1);
147153
PairwiseSequenceAligner<DNASequence, NucleotideCompound> aligner = Alignments.getPairwiseAligner(query, target, PairwiseSequenceAlignerType.GLOBAL, gapP, matrix);
148-
assertEquals(2, aligner.getPair().getLength());
154+
Assert.assertEquals(2, aligner.getPair().getLength());
149155
}
150156
/**
151157
* @author Daniel Cameron
152158
*/
159+
@Test
153160
public void testLinearAlignment() throws CompoundNotFoundException {
154161
DNASequence query = new DNASequence("GTAAAAG", DNACompoundSet.getDNACompoundSet());
155162
DNASequence target = new DNASequence("GAAAACGTTTTTTTTTT", DNACompoundSet.getDNACompoundSet());
156163
SubstitutionMatrix<NucleotideCompound> matrix = SubstitutionMatrixHelper.getNuc4_4();
157164
SimpleGapPenalty gapP = new SimpleGapPenalty((short)0, (short)3);
158165
PairwiseSequenceAligner<DNASequence, NucleotideCompound> aligner = Alignments.getPairwiseAligner(query, target, PairwiseSequenceAlignerType.GLOBAL, gapP, matrix);
159-
assertEquals(String.format("GTAAAA-G----------%nG-AAAACGTTTTTTTTTT%n"), aligner.getPair().toString());;
166+
Assert.assertEquals(String.format("GTAAAA-G----------%nG-AAAACGTTTTTTTTTT%n"), aligner.getPair().toString());;
160167
}
161168
}

biojava-alignment/src/test/java/org/biojava/nbio/alignment/aaindex/TestAAINDEXLoading.java

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121
package org.biojava.nbio.alignment.aaindex;
2222

2323
import org.biojava.nbio.core.alignment.matrices.ScaledSubstitutionMatrix;
24-
import junit.framework.TestCase;
2524
import org.biojava.nbio.core.alignment.matrices.SubstitutionMatrixHelper;
2625
import org.biojava.nbio.core.alignment.template.SubstitutionMatrix;
2726
import org.biojava.nbio.core.sequence.compound.AminoAcidCompound;
2827
import org.biojava.nbio.core.sequence.compound.AminoAcidCompoundSet;
28+
import org.junit.Assert;
29+
import org.junit.Test;
2930

3031

31-
32-
public class TestAAINDEXLoading extends TestCase{
32+
public class TestAAINDEXLoading {
3333
/**
3434
*
3535
* M rows = ARNDCQEGHILKMFPSTWYV, cols = ARNDCQEGHILKMFPSTWYV
@@ -57,6 +57,7 @@ public class TestAAINDEXLoading extends TestCase{
5757
V 0.02 -1.52 -2.17 -2.02 0.34 -1.38 -1.84 -1.96 -0.35 1.94 0.81 -1.27 0.61 0.51 -1.11 -1.11 0.05 -1.09 0.21 2.05
5858
5959
*/
60+
@Test
6061
public void testSDMmatrix(){
6162
String matrixName = "PRLA000101";
6263

@@ -66,7 +67,7 @@ public void testSDMmatrix(){
6667
if ( sdm instanceof ScaledSubstitutionMatrix) {
6768
ScaledSubstitutionMatrix scaledSDM = (ScaledSubstitutionMatrix)sdm;
6869
scale = scaledSDM.getScale();
69-
assertEquals(100,scale);
70+
Assert.assertEquals(100, scale);
7071
}
7172

7273

@@ -78,20 +79,20 @@ public void testSDMmatrix(){
7879
AminoAcidCompound n = aas.getCompoundForString("N");
7980

8081
short rn = sdm.getValue(r,n);
81-
assertEquals(60,rn);
82+
Assert.assertEquals(60, rn);
8283

8384
short nr = sdm.getValue(n,r);
84-
assertEquals(rn,nr);
85+
Assert.assertEquals(rn, nr);
8586

8687

8788
short vv = sdm.getValue(v,v);
88-
assertEquals(205,vv);
89+
Assert.assertEquals(205, vv);
8990

9091
short vw = sdm.getValue(v,w);
91-
assertEquals( -109,vw);
92+
Assert.assertEquals(-109, vw);
9293

9394
short wv = sdm.getValue(w,v);
94-
assertEquals(vw,wv);
95+
Assert.assertEquals(vw, wv);
9596

9697

9798

@@ -136,6 +137,7 @@ public void testSDMmatrix(){
136137
*
137138
*/
138139

140+
@Test
139141
public void testOVEJ920104(){
140142
String name = "OVEJ920104";
141143
SubstitutionMatrix<AminoAcidCompound> max = SubstitutionMatrixHelper.getMatrixFromAAINDEX(name);
@@ -144,7 +146,7 @@ public void testOVEJ920104(){
144146
ScaledSubstitutionMatrix scaledMAX = (ScaledSubstitutionMatrix) max;
145147
int scale = scaledMAX.getScale();
146148

147-
assertEquals(1000,scale);
149+
Assert.assertEquals(1000, scale);
148150
}
149151

150152
AminoAcidCompoundSet aas = AminoAcidCompoundSet.getAminoAcidCompoundSet();
@@ -156,20 +158,20 @@ public void testOVEJ920104(){
156158
AminoAcidCompound a = aas.getCompoundForString("A");
157159

158160
short ay = max.getValue(a,y);
159-
assertEquals(35,ay);
161+
Assert.assertEquals(35, ay);
160162

161163

162164
short ya = max.getValue(y,a);
163-
assertEquals(14,ya);
165+
Assert.assertEquals(14, ya);
164166

165167
short minusa = max.getValue(minus, a);
166-
assertEquals(86, minusa);
168+
Assert.assertEquals(86, minusa);
167169

168170
short minusy = max.getValue(minus, y);
169-
assertEquals( 48,minusy);
171+
Assert.assertEquals(48, minusy);
170172

171173
short minusj = max.getValue(minus, j);
172-
assertEquals( 91,minusj);
174+
Assert.assertEquals(91, minusj);
173175

174176
}
175177

biojava-alignment/src/test/java/org/biojava/nbio/alignment/io/TestStockholmParser.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,16 @@
2323
//import java.io.BufferedReader;
2424
//import java.io.IOException;
2525

26-
import junit.framework.TestCase;
2726
import org.biojava.nbio.core.sequence.template.AbstractSequence;
27+
import org.junit.Assert;
28+
import org.junit.Test;
2829

2930
import java.io.InputStream;
3031
import java.util.zip.GZIPInputStream;
3132

3233
//import java.io.InputStreamReader;
3334

34-
public class TestStockholmParser extends TestCase {
35+
public class TestStockholmParser {
3536

3637
// public void testStockholmParser(){
3738
//
@@ -66,27 +67,28 @@ public class TestStockholmParser extends TestCase {
6667
//
6768
// }
6869

70+
@Test
6971
public void testPiwi(){
7072
try {
7173
InputStream inStream = new GZIPInputStream(this.getClass().getResourceAsStream("/piwi.sth.gz"));
7274

73-
assertNotNull(inStream);
75+
Assert.assertNotNull(inStream);
7476

7577
StockholmFileParser fileParser = new StockholmFileParser();
7678

7779
StockholmStructure data = fileParser.parse(inStream);
7880

79-
assertTrue("Did not get enough sequences!", data.getBioSequences(false).size()==20);
81+
Assert.assertTrue("Did not get enough sequences!", data.getBioSequences(false).size() == 20);
8082

8183
AbstractSequence<?> seq = data.getBioSequences(false).get(0);
82-
assertTrue(seq != null );
84+
Assert.assertTrue(seq != null);
8385

84-
assertTrue(seq.getSequenceAsString().length() > 20);
86+
Assert.assertTrue(seq.getSequenceAsString().length() > 20);
8587

8688
} catch (Exception e) {
8789

8890
e.printStackTrace();
89-
fail(e.getMessage());
91+
Assert.fail(e.getMessage());
9092
}
9193

9294

biojava-core/src/test/java/org/biojava/nbio/core/TestAmbiguityCompoundSet.java

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

23-
import junit.framework.TestCase;
2423
import org.biojava.nbio.core.exceptions.CompoundNotFoundException;
2524
import org.biojava.nbio.core.sequence.DNASequence;
2625
import org.biojava.nbio.core.sequence.RNASequence;
@@ -31,6 +30,7 @@
3130
import org.biojava.nbio.core.sequence.template.CompoundSet;
3231
import org.biojava.nbio.core.sequence.template.Sequence;
3332
import org.biojava.nbio.core.sequence.transcription.DNAToRNATranslator;
33+
import org.junit.Assert;
3434
import org.junit.Test;
3535

3636
/**
@@ -39,38 +39,34 @@
3939
* Created by andreas on 12/4/15.
4040
*/
4141

42-
public class TestAmbiguityCompoundSet extends TestCase{
42+
public class TestAmbiguityCompoundSet {
4343

4444
@Test
45-
public void testCompountSet(){
46-
try {
45+
public void testCompountSet() throws Exception {
4746

48-
CompoundSet<NucleotideCompound> dnaSet = AmbiguityDNACompoundSet.getDNACompoundSet();
49-
CompoundSet<NucleotideCompound> rnaSet = AmbiguityRNACompoundSet.getRNACompoundSet();
47+
CompoundSet<NucleotideCompound> dnaSet = AmbiguityDNACompoundSet.getDNACompoundSet();
48+
CompoundSet<NucleotideCompound> rnaSet = AmbiguityRNACompoundSet.getRNACompoundSet();
5049

51-
DNASequence dna=new DNASequence("AGTCS", dnaSet);
50+
DNASequence dna = new DNASequence("AGTCS", dnaSet);
5251

53-
assertEquals("AGTCS",dna.toString());
52+
Assert.assertEquals("AGTCS", dna.toString());
5453

55-
RNASequence rna = dna.getRNASequence();
54+
RNASequence rna = dna.getRNASequence();
5655

57-
rna = new RNASequence(dna.getSequenceAsString().replaceAll("T", "U"), AmbiguityRNACompoundSet.getRNACompoundSet()); //fails with missing compound S
56+
rna = new RNASequence(dna.getSequenceAsString().replaceAll("T", "U"), AmbiguityRNACompoundSet.getRNACompoundSet()); //fails with missing compound S
5857

59-
assertEquals("AGUCS",rna.toString());
58+
Assert.assertEquals("AGUCS", rna.toString());
6059

61-
/** now, do the translation also using the underlying API (should not be needed for a user)
62-
*
63-
*/
64-
DNAToRNATranslator translator = new DNAToRNATranslator(new RNASequenceCreator(rnaSet
65-
),dnaSet,rnaSet,false);
60+
/* now, do the translation also using the underlying API (should not be needed for a user)
61+
*
62+
*/
63+
DNAToRNATranslator translator = new DNAToRNATranslator(new RNASequenceCreator(rnaSet
64+
), dnaSet, rnaSet, false);
6665

67-
Sequence<NucleotideCompound> translated = translator.createSequence(dna);
66+
Sequence<NucleotideCompound> translated = translator.createSequence(dna);
67+
68+
Assert.assertEquals("AGUCS", translated.toString());
6869

69-
assertEquals("AGUCS", translated.toString());
7070

71-
} catch (CompoundNotFoundException e) {
72-
e.printStackTrace();
73-
fail(e.getMessage());
74-
}
7571
}
7672
}

0 commit comments

Comments
 (0)