Skip to content

Commit 4c1e7b2

Browse files
authored
Use Junit4 annotations
1 parent 7143d9b commit 4c1e7b2

39 files changed

+625
-427
lines changed

src/test/java/org/codehaus/plexus/util/CollectionUtilsTest.java

+10-2
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,21 @@
1616
* limitations under the License.
1717
*/
1818

19+
import static org.junit.Assert.assertEquals;
20+
import static org.junit.Assert.assertNotNull;
21+
import static org.junit.Assert.assertNull;
22+
1923
import java.util.ArrayList;
2024
import java.util.HashMap;
2125
import java.util.List;
2226
import java.util.Map;
2327
import java.util.Properties;
2428

25-
import junit.framework.TestCase;
29+
import org.junit.Test;
2630

2731
public class CollectionUtilsTest
28-
extends TestCase
2932
{
33+
@Test
3034
public void testMergeMaps()
3135
{
3236
Map<String, String> dominantMap = new HashMap<String, String>();
@@ -63,6 +67,7 @@ public void testMergeMaps()
6367
}
6468

6569
@SuppressWarnings( "unchecked" )
70+
@Test
6671
public void testMergeMapArray()
6772
{
6873
// Test empty array of Maps
@@ -114,6 +119,7 @@ public void testMergeMapArray()
114119
assertEquals( "ccc", result5.get( "c" ) );
115120
}
116121

122+
@Test
117123
public void testMavenPropertiesLoading()
118124
{
119125
// Mimic MavenSession properties loading. Properties listed
@@ -170,6 +176,7 @@ public void testMavenPropertiesLoading()
170176
assertEquals( mavenRepoRemote, (String) result.get( "maven.repo.remote" ) );
171177
}
172178

179+
@Test
173180
public void testIteratorToListWithAPopulatedList()
174181
{
175182
List<String> original = new ArrayList<String>();
@@ -189,6 +196,7 @@ public void testIteratorToListWithAPopulatedList()
189196
assertEquals( "tre", copy.get( 2 ) );
190197
}
191198

199+
@Test
192200
public void testIteratorToListWithAEmptyList()
193201
{
194202
List<String> original = new ArrayList<String>();

src/test/java/org/codehaus/plexus/util/DirectoryScannerTest.java

+21
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616
* limitations under the License.
1717
*/
1818

19+
import static org.junit.Assert.assertEquals;
20+
import static org.junit.Assert.assertFalse;
21+
import static org.junit.Assert.assertTrue;
22+
import static org.junit.Assert.fail;
23+
1924
import java.io.File;
2025
import java.io.IOException;
2126
import java.net.URI;
@@ -25,6 +30,8 @@
2530
import java.util.Arrays;
2631
import java.util.List;
2732

33+
import org.junit.Test;
34+
2835
/**
2936
* Base class for testcases doing tests with files.
3037
*
@@ -35,6 +42,7 @@ public class DirectoryScannerTest
3542
{
3643
private static String testDir = getTestDirectory().getPath();
3744

45+
@Test
3846
public void testCrossPlatformIncludesString()
3947
throws IOException, URISyntaxException
4048
{
@@ -59,6 +67,7 @@ public void testCrossPlatformIncludesString()
5967
assertEquals( 1, files.length );
6068
}
6169

70+
@Test
6271
public void testCrossPlatformExcludesString()
6372
throws IOException, URISyntaxException
6473
{
@@ -110,6 +119,7 @@ private void createTestFiles()
110119
this.createFile( new File( testDir + "/scanner5.dat" ), 0 );
111120
}
112121

122+
@Test
113123
public void testGeneral()
114124
throws IOException
115125
{
@@ -127,6 +137,7 @@ public void testGeneral()
127137

128138
}
129139

140+
@Test
130141
public void testIncludesExcludesWithWhiteSpaces()
131142
throws IOException
132143
{
@@ -144,6 +155,7 @@ public void testIncludesExcludesWithWhiteSpaces()
144155
assertTrue( "5 not found.", fileNames.contains( new File( "scanner5.dat" ) ) );
145156
}
146157

158+
@Test
147159
public void testFollowSymlinksFalse()
148160
{
149161
DirectoryScanner ds = new DirectoryScanner();
@@ -175,6 +187,7 @@ private void assertAlwaysIncluded( List<String> included )
175187
assertTrue( included.contains( "symLinkToFileOnTheOutside" ) );
176188
}
177189

190+
@Test
178191
public void testFollowSymlinks()
179192
{
180193
DirectoryScanner ds = new DirectoryScanner();
@@ -211,6 +224,7 @@ private void createTestDirectories()
211224
+ File.separator + "file1.dat" ), 0 );
212225
}
213226

227+
@Test
214228
public void testDirectoriesWithHyphens()
215229
throws IOException
216230
{
@@ -229,6 +243,7 @@ public void testDirectoriesWithHyphens()
229243
assertEquals( "Wrong number of results.", 3, files.length );
230244
}
231245

246+
@Test
232247
public void testAntExcludesOverrideIncludes()
233248
throws IOException
234249
{
@@ -263,6 +278,7 @@ public void testAntExcludesOverrideIncludes()
263278
assertInclusionsAndExclusions( ds.getIncludedFiles(), excludedPaths, includedPaths );
264279
}
265280

281+
@Test
266282
public void testAntExcludesOverrideIncludesWithExplicitAntPrefix()
267283
throws IOException
268284
{
@@ -298,6 +314,7 @@ public void testAntExcludesOverrideIncludesWithExplicitAntPrefix()
298314
assertInclusionsAndExclusions( ds.getIncludedFiles(), excludedPaths, includedPaths );
299315
}
300316

317+
@Test
301318
public void testRegexIncludeWithExcludedPrefixDirs()
302319
throws IOException
303320
{
@@ -328,6 +345,7 @@ public void testRegexIncludeWithExcludedPrefixDirs()
328345
assertInclusionsAndExclusions( ds.getIncludedFiles(), excludedPaths, includedPaths );
329346
}
330347

348+
@Test
331349
public void testRegexExcludeWithNegativeLookahead()
332350
throws IOException
333351
{
@@ -366,6 +384,7 @@ public void testRegexExcludeWithNegativeLookahead()
366384
assertInclusionsAndExclusions( ds.getIncludedFiles(), excludedPaths, includedPaths );
367385
}
368386

387+
@Test
369388
public void testRegexWithSlashInsideCharacterClass()
370389
throws IOException
371390
{
@@ -405,6 +424,7 @@ public void testRegexWithSlashInsideCharacterClass()
405424
assertInclusionsAndExclusions( ds.getIncludedFiles(), excludedPaths, includedPaths );
406425
}
407426

427+
@Test
408428
public void testIsSymbolicLink()
409429
throws IOException
410430
{
@@ -422,6 +442,7 @@ public void testIsSymbolicLink()
422442
assertFalse( ds.isSymbolicLink( directory, "aRegularDir" ) );
423443
}
424444

445+
@Test
425446
public void testIsParentSymbolicLink()
426447
throws IOException
427448
{

src/test/java/org/codehaus/plexus/util/DirectoryWalkerTest.java

+6-2
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,17 @@
1616
* limitations under the License.
1717
*/
1818

19+
import static org.junit.Assert.assertEquals;
20+
import static org.junit.Assert.assertNotNull;
21+
import static org.junit.Assert.assertTrue;
22+
1923
import java.io.File;
2024

21-
import junit.framework.TestCase;
25+
import org.junit.Test;
2226

2327
public class DirectoryWalkerTest
24-
extends TestCase
2528
{
29+
@Test
2630
public void testDirectoryWalk()
2731
{
2832
DirectoryWalker walker = new DirectoryWalker();

src/test/java/org/codehaus/plexus/util/FileBasedTestCase.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
* limitations under the License.
1717
*/
1818

19+
import static org.junit.Assert.assertTrue;
20+
1921
import java.io.BufferedOutputStream;
2022
import java.io.ByteArrayOutputStream;
2123
import java.io.File;
@@ -30,15 +32,13 @@
3032
import java.util.Arrays;
3133

3234
import junit.framework.AssertionFailedError;
33-
import junit.framework.TestCase;
3435

3536
/**
3637
* Base class for testcases doing tests with files.
3738
*
3839
* @author Jeremias Maerki
3940
*/
4041
public abstract class FileBasedTestCase
41-
extends TestCase
4242
{
4343
private static File testDir;
4444

0 commit comments

Comments
 (0)