Skip to content

Commit 2006d95

Browse files
committed
Using JUnit 4 for TestCopyMojo to enable Assumptions
1 parent 0d363ab commit 2006d95

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestCopyMojo.java

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,19 @@
3636
import org.apache.maven.plugins.dependency.AbstractDependencyMojoTestCase;
3737
import org.apache.maven.plugins.dependency.utils.DependencyUtil;
3838
import org.apache.maven.project.MavenProject;
39+
import org.junit.Before;
40+
import org.junit.Test;
41+
import org.junit.runner.RunWith;
42+
import org.junit.runners.BlockJUnit4ClassRunner;
3943

44+
@RunWith(BlockJUnit4ClassRunner.class)
4045
public class TestCopyMojo
4146
extends AbstractDependencyMojoTestCase
4247
{
4348
private CopyMojo mojo;
4449

45-
protected void setUp()
50+
@Before
51+
public void setUp()
4652
throws Exception
4753
{
4854
super.setUp( "copy", false, false );
@@ -84,6 +90,7 @@ public void testSetArtifactWithoutPackaging()
8490
assertNull( item.getClassifier() );
8591
}
8692

93+
@Test
8794
public void testSetArtifactWithoutClassifier()
8895
throws Exception
8996
{
@@ -96,6 +103,7 @@ public void testSetArtifactWithoutClassifier()
96103
assertNull( item.getClassifier() );
97104
}
98105

106+
@Test
99107
public void testSetArtifact()
100108
throws Exception
101109
{
@@ -108,6 +116,7 @@ public void testSetArtifact()
108116
assertEquals( "e", item.getClassifier() );
109117
}
110118

119+
@Test
111120
public void testGetArtifactItems()
112121
throws Exception
113122
{
@@ -160,6 +169,7 @@ public void assertFileIsLink( ArtifactItem item, boolean isLink )
160169
assertEquals( isLink, Files.isSymbolicLink( path ) );
161170
}
162171

172+
@Test
163173
public void testMojoDefaults()
164174
{
165175
CopyMojo themojo = new CopyMojo();
@@ -169,6 +179,7 @@ public void testMojoDefaults()
169179
assertFalse( themojo.isStripClassifier() );
170180
}
171181

182+
@Test
172183
public void testCopyFile()
173184
throws Exception
174185
{
@@ -181,6 +192,7 @@ public void testCopyFile()
181192
assertFilesExist( list, true );
182193
}
183194

195+
@Test
184196
public void testCopyFileWithBaseVersion()
185197
throws Exception
186198
{
@@ -200,6 +212,7 @@ public void testCopyFileWithBaseVersion()
200212
assertFilesExist( list, true );
201213
}
202214

215+
@Test
203216
public void testSkip()
204217
throws Exception
205218
{
@@ -218,6 +231,7 @@ public void testSkip()
218231

219232
}
220233

234+
@Test
221235
public void testCopyFileNoOverwrite()
222236
throws Exception
223237
{
@@ -235,6 +249,7 @@ public void testCopyFileNoOverwrite()
235249
assertFilesExist( list, true );
236250
}
237251

252+
@Test
238253
public void testCopyToLocation()
239254
throws Exception
240255
{
@@ -249,6 +264,7 @@ public void testCopyToLocation()
249264
assertFilesExist( list, true );
250265
}
251266

267+
@Test
252268
public void testLink()
253269
throws Exception
254270
{
@@ -263,6 +279,7 @@ public void testLink()
263279
assertFilesAreLinks( list, true );
264280
}
265281

282+
@Test
266283
public void testCopyStripVersionSetInMojo()
267284
throws Exception
268285
{
@@ -280,6 +297,7 @@ public void testCopyStripVersionSetInMojo()
280297
assertFilesExist( list, true );
281298
}
282299

300+
@Test
283301
public void testCopyStripClassifierSetInMojo()
284302
throws Exception
285303
{
@@ -298,6 +316,7 @@ public void testCopyStripClassifierSetInMojo()
298316
assertFilesExist( list, true );
299317
}
300318

319+
@Test
301320
public void testNonClassifierStrip()
302321
throws Exception
303322
{
@@ -310,6 +329,7 @@ public void testNonClassifierStrip()
310329
assertFilesExist( list, true );
311330
}
312331

332+
@Test
313333
public void testNonClassifierNoStrip()
314334
throws Exception
315335
{
@@ -322,6 +342,7 @@ public void testNonClassifierNoStrip()
322342
assertFilesExist( list, true );
323343
}
324344

345+
@Test
325346
public void testMissingVersionNotFound()
326347
throws Exception
327348
{
@@ -370,6 +391,7 @@ public List<Dependency> getDependencyList( ArtifactItem item )
370391
return list;
371392
}
372393

394+
@Test
373395
public void testMissingVersionFromDependencies()
374396
throws Exception
375397
{
@@ -392,6 +414,7 @@ public void testMissingVersionFromDependencies()
392414
assertEquals( "2.0-SNAPSHOT", item.getVersion() );
393415
}
394416

417+
@Test
395418
public void testMissingVersionFromDependenciesLooseMatch()
396419
throws Exception
397420
{
@@ -423,6 +446,7 @@ public void testMissingVersionFromDependenciesLooseMatch()
423446
assertEquals( "2.1", item.getVersion() );
424447
}
425448

449+
@Test
426450
public void testMissingVersionFromDependenciesWithClassifier()
427451
throws Exception
428452
{
@@ -468,6 +492,7 @@ public List<Dependency> getDependencyMgtList( ArtifactItem item )
468492
return list;
469493
}
470494

495+
@Test
471496
public void testMissingVersionFromDependencyMgt()
472497
throws Exception
473498
{
@@ -501,6 +526,7 @@ public void testMissingVersionFromDependencyMgt()
501526
assertEquals( "3.0-SNAPSHOT", item.getVersion() );
502527
}
503528

529+
@Test
504530
public void testMissingVersionFromDependencyMgtLooseMatch()
505531
throws Exception
506532
{
@@ -541,6 +567,7 @@ public void testMissingVersionFromDependencyMgtLooseMatch()
541567
assertEquals( "3.1", item.getVersion() );
542568
}
543569

570+
@Test
544571
public void testMissingVersionFromDependencyMgtWithClassifier()
545572
throws Exception
546573
{
@@ -574,12 +601,14 @@ public void testMissingVersionFromDependencyMgtWithClassifier()
574601
assertEquals( "3.1", item.getVersion() );
575602
}
576603

604+
@Test
577605
public void testArtifactNotFound()
578606
throws Exception
579607
{
580608
dotestArtifactExceptions( false, true );
581609
}
582610

611+
@Test
583612
public void testArtifactResolutionException()
584613
throws Exception
585614
{
@@ -612,6 +641,7 @@ public void dotestArtifactExceptions( boolean are, boolean anfe )
612641
}
613642
}
614643

644+
@Test
615645
public void testNoArtifactItems()
616646
{
617647
try
@@ -626,6 +656,7 @@ public void testNoArtifactItems()
626656

627657
}
628658

659+
@Test
629660
public void testCopyDontOverWriteReleases()
630661
throws Exception
631662
{
@@ -657,6 +688,7 @@ public void testCopyDontOverWriteReleases()
657688
assertEquals( time, copiedFile.lastModified() );
658689
}
659690

691+
@Test
660692
public void testCopyDontOverWriteSnapshots()
661693
throws Exception
662694
{
@@ -688,6 +720,7 @@ public void testCopyDontOverWriteSnapshots()
688720
assertEquals( time, copiedFile.lastModified() );
689721
}
690722

723+
@Test
691724
public void testCopyOverWriteReleases()
692725
throws Exception
693726
{
@@ -717,6 +750,7 @@ public void testCopyOverWriteReleases()
717750
assertEquals( 1000L, timeCopyNow );
718751
}
719752

753+
@Test
720754
public void testCopyOverWriteSnapshot()
721755
throws Exception
722756
{
@@ -747,6 +781,7 @@ public void testCopyOverWriteSnapshot()
747781
assertEquals( 1000L, timeCopyNow );
748782
}
749783

784+
@Test
750785
public void testCopyOverWriteIfNewer()
751786
throws Exception
752787
{
@@ -776,6 +811,7 @@ public void testCopyOverWriteIfNewer()
776811
assertTrue( time < copiedFile.lastModified() );
777812
}
778813

814+
@Test
779815
public void testCopyFileWithOverideLocalRepo()
780816
throws Exception
781817
{

0 commit comments

Comments
 (0)