36
36
import org .apache .maven .plugins .dependency .AbstractDependencyMojoTestCase ;
37
37
import org .apache .maven .plugins .dependency .utils .DependencyUtil ;
38
38
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 ;
39
43
44
+ @ RunWith (BlockJUnit4ClassRunner .class )
40
45
public class TestCopyMojo
41
46
extends AbstractDependencyMojoTestCase
42
47
{
43
48
private CopyMojo mojo ;
44
49
45
- protected void setUp ()
50
+ @ Before
51
+ public void setUp ()
46
52
throws Exception
47
53
{
48
54
super .setUp ( "copy" , false , false );
@@ -84,6 +90,7 @@ public void testSetArtifactWithoutPackaging()
84
90
assertNull ( item .getClassifier () );
85
91
}
86
92
93
+ @ Test
87
94
public void testSetArtifactWithoutClassifier ()
88
95
throws Exception
89
96
{
@@ -96,6 +103,7 @@ public void testSetArtifactWithoutClassifier()
96
103
assertNull ( item .getClassifier () );
97
104
}
98
105
106
+ @ Test
99
107
public void testSetArtifact ()
100
108
throws Exception
101
109
{
@@ -108,6 +116,7 @@ public void testSetArtifact()
108
116
assertEquals ( "e" , item .getClassifier () );
109
117
}
110
118
119
+ @ Test
111
120
public void testGetArtifactItems ()
112
121
throws Exception
113
122
{
@@ -160,6 +169,7 @@ public void assertFileIsLink( ArtifactItem item, boolean isLink )
160
169
assertEquals ( isLink , Files .isSymbolicLink ( path ) );
161
170
}
162
171
172
+ @ Test
163
173
public void testMojoDefaults ()
164
174
{
165
175
CopyMojo themojo = new CopyMojo ();
@@ -169,6 +179,7 @@ public void testMojoDefaults()
169
179
assertFalse ( themojo .isStripClassifier () );
170
180
}
171
181
182
+ @ Test
172
183
public void testCopyFile ()
173
184
throws Exception
174
185
{
@@ -181,6 +192,7 @@ public void testCopyFile()
181
192
assertFilesExist ( list , true );
182
193
}
183
194
195
+ @ Test
184
196
public void testCopyFileWithBaseVersion ()
185
197
throws Exception
186
198
{
@@ -200,6 +212,7 @@ public void testCopyFileWithBaseVersion()
200
212
assertFilesExist ( list , true );
201
213
}
202
214
215
+ @ Test
203
216
public void testSkip ()
204
217
throws Exception
205
218
{
@@ -218,6 +231,7 @@ public void testSkip()
218
231
219
232
}
220
233
234
+ @ Test
221
235
public void testCopyFileNoOverwrite ()
222
236
throws Exception
223
237
{
@@ -235,6 +249,7 @@ public void testCopyFileNoOverwrite()
235
249
assertFilesExist ( list , true );
236
250
}
237
251
252
+ @ Test
238
253
public void testCopyToLocation ()
239
254
throws Exception
240
255
{
@@ -249,6 +264,7 @@ public void testCopyToLocation()
249
264
assertFilesExist ( list , true );
250
265
}
251
266
267
+ @ Test
252
268
public void testLink ()
253
269
throws Exception
254
270
{
@@ -263,6 +279,7 @@ public void testLink()
263
279
assertFilesAreLinks ( list , true );
264
280
}
265
281
282
+ @ Test
266
283
public void testCopyStripVersionSetInMojo ()
267
284
throws Exception
268
285
{
@@ -280,6 +297,7 @@ public void testCopyStripVersionSetInMojo()
280
297
assertFilesExist ( list , true );
281
298
}
282
299
300
+ @ Test
283
301
public void testCopyStripClassifierSetInMojo ()
284
302
throws Exception
285
303
{
@@ -298,6 +316,7 @@ public void testCopyStripClassifierSetInMojo()
298
316
assertFilesExist ( list , true );
299
317
}
300
318
319
+ @ Test
301
320
public void testNonClassifierStrip ()
302
321
throws Exception
303
322
{
@@ -310,6 +329,7 @@ public void testNonClassifierStrip()
310
329
assertFilesExist ( list , true );
311
330
}
312
331
332
+ @ Test
313
333
public void testNonClassifierNoStrip ()
314
334
throws Exception
315
335
{
@@ -322,6 +342,7 @@ public void testNonClassifierNoStrip()
322
342
assertFilesExist ( list , true );
323
343
}
324
344
345
+ @ Test
325
346
public void testMissingVersionNotFound ()
326
347
throws Exception
327
348
{
@@ -370,6 +391,7 @@ public List<Dependency> getDependencyList( ArtifactItem item )
370
391
return list ;
371
392
}
372
393
394
+ @ Test
373
395
public void testMissingVersionFromDependencies ()
374
396
throws Exception
375
397
{
@@ -392,6 +414,7 @@ public void testMissingVersionFromDependencies()
392
414
assertEquals ( "2.0-SNAPSHOT" , item .getVersion () );
393
415
}
394
416
417
+ @ Test
395
418
public void testMissingVersionFromDependenciesLooseMatch ()
396
419
throws Exception
397
420
{
@@ -423,6 +446,7 @@ public void testMissingVersionFromDependenciesLooseMatch()
423
446
assertEquals ( "2.1" , item .getVersion () );
424
447
}
425
448
449
+ @ Test
426
450
public void testMissingVersionFromDependenciesWithClassifier ()
427
451
throws Exception
428
452
{
@@ -468,6 +492,7 @@ public List<Dependency> getDependencyMgtList( ArtifactItem item )
468
492
return list ;
469
493
}
470
494
495
+ @ Test
471
496
public void testMissingVersionFromDependencyMgt ()
472
497
throws Exception
473
498
{
@@ -501,6 +526,7 @@ public void testMissingVersionFromDependencyMgt()
501
526
assertEquals ( "3.0-SNAPSHOT" , item .getVersion () );
502
527
}
503
528
529
+ @ Test
504
530
public void testMissingVersionFromDependencyMgtLooseMatch ()
505
531
throws Exception
506
532
{
@@ -541,6 +567,7 @@ public void testMissingVersionFromDependencyMgtLooseMatch()
541
567
assertEquals ( "3.1" , item .getVersion () );
542
568
}
543
569
570
+ @ Test
544
571
public void testMissingVersionFromDependencyMgtWithClassifier ()
545
572
throws Exception
546
573
{
@@ -574,12 +601,14 @@ public void testMissingVersionFromDependencyMgtWithClassifier()
574
601
assertEquals ( "3.1" , item .getVersion () );
575
602
}
576
603
604
+ @ Test
577
605
public void testArtifactNotFound ()
578
606
throws Exception
579
607
{
580
608
dotestArtifactExceptions ( false , true );
581
609
}
582
610
611
+ @ Test
583
612
public void testArtifactResolutionException ()
584
613
throws Exception
585
614
{
@@ -612,6 +641,7 @@ public void dotestArtifactExceptions( boolean are, boolean anfe )
612
641
}
613
642
}
614
643
644
+ @ Test
615
645
public void testNoArtifactItems ()
616
646
{
617
647
try
@@ -626,6 +656,7 @@ public void testNoArtifactItems()
626
656
627
657
}
628
658
659
+ @ Test
629
660
public void testCopyDontOverWriteReleases ()
630
661
throws Exception
631
662
{
@@ -657,6 +688,7 @@ public void testCopyDontOverWriteReleases()
657
688
assertEquals ( time , copiedFile .lastModified () );
658
689
}
659
690
691
+ @ Test
660
692
public void testCopyDontOverWriteSnapshots ()
661
693
throws Exception
662
694
{
@@ -688,6 +720,7 @@ public void testCopyDontOverWriteSnapshots()
688
720
assertEquals ( time , copiedFile .lastModified () );
689
721
}
690
722
723
+ @ Test
691
724
public void testCopyOverWriteReleases ()
692
725
throws Exception
693
726
{
@@ -717,6 +750,7 @@ public void testCopyOverWriteReleases()
717
750
assertEquals ( 1000L , timeCopyNow );
718
751
}
719
752
753
+ @ Test
720
754
public void testCopyOverWriteSnapshot ()
721
755
throws Exception
722
756
{
@@ -747,6 +781,7 @@ public void testCopyOverWriteSnapshot()
747
781
assertEquals ( 1000L , timeCopyNow );
748
782
}
749
783
784
+ @ Test
750
785
public void testCopyOverWriteIfNewer ()
751
786
throws Exception
752
787
{
@@ -776,6 +811,7 @@ public void testCopyOverWriteIfNewer()
776
811
assertTrue ( time < copiedFile .lastModified () );
777
812
}
778
813
814
+ @ Test
779
815
public void testCopyFileWithOverideLocalRepo ()
780
816
throws Exception
781
817
{
0 commit comments