2424import java .util .List ;
2525import java .util .Random ;
2626
27- import junit .framework .TestCase ;
2827import org .apache .maven .artifact .Artifact ;
2928import org .apache .maven .artifact .DefaultArtifact ;
3029import org .apache .maven .artifact .handler .ArtifactHandler ;
3433import org .apache .maven .plugin .logging .Log ;
3534import org .apache .maven .plugin .testing .SilentLog ;
3635import org .apache .maven .plugins .dependency .testUtils .stubs .StubSourcesFileMarkerHandler ;
36+ import org .junit .jupiter .api .AfterEach ;
37+ import org .junit .jupiter .api .BeforeEach ;
38+ import org .junit .jupiter .api .Test ;
39+
40+ import static org .junit .Assert .assertFalse ;
41+ import static org .junit .Assert .assertTrue ;
42+ import static org .junit .Assert .fail ;
3743
3844/**
3945 * @author brianf
4046 */
41- public class TestSourcesMarkerFileHandler extends TestCase {
47+ public class TestSourcesMarkerFileHandler {
4248 List <Artifact > artifacts = new ArrayList <>();
4349
4450 Log log = new SilentLog ();
4551
4652 File outputFolder ;
4753
48- protected void setUp () throws Exception {
49- super . setUp ();
54+ @ BeforeEach
55+ public void setUp () throws Exception {
5056
5157 ArtifactHandler ah = new DefaultArtifactHandler ();
5258 VersionRange vr = VersionRange .createFromVersion ("1.1" );
@@ -66,10 +72,12 @@ protected void setUp() throws Exception {
6672 assertFalse (outputFolder .exists ());
6773 }
6874
69- protected void tearDown () {
75+ @ AfterEach
76+ public void tearDown () {
7077 outputFolder .delete ();
7178 }
7279
80+ @ Test
7381 public void testSetMarkerResolved () throws MojoExecutionException {
7482 DefaultFileMarkerHandler handler = new SourcesFileMarkerHandler (artifacts .get (0 ), this .outputFolder , true );
7583 assertFalse (handler .isMarkerSet ());
@@ -88,6 +96,7 @@ public void testSetMarkerResolved() throws MojoExecutionException {
8896 assertFalse (outputFolder .exists ());
8997 }
9098
99+ @ Test
91100 public void testSetMarkerUnresolved () throws MojoExecutionException {
92101 DefaultFileMarkerHandler handler = new SourcesFileMarkerHandler (artifacts .get (0 ), this .outputFolder , false );
93102 assertFalse (handler .isMarkerSet ());
@@ -106,6 +115,7 @@ public void testSetMarkerUnresolved() throws MojoExecutionException {
106115 assertFalse (outputFolder .exists ());
107116 }
108117
118+ @ Test
109119 public void testBothMarkers () throws MojoExecutionException {
110120 DefaultFileMarkerHandler handler = new SourcesFileMarkerHandler (artifacts .get (1 ), this .outputFolder , true );
111121 DefaultFileMarkerHandler handler2 = new SourcesFileMarkerHandler (artifacts .get (1 ), this .outputFolder , false );
@@ -121,6 +131,7 @@ public void testBothMarkers() throws MojoExecutionException {
121131 assertFalse (outputFolder .exists ());
122132 }
123133
134+ @ Test
124135 public void testMarkerFile () throws MojoExecutionException , IOException {
125136 DefaultFileMarkerHandler handler = new SourcesFileMarkerHandler (artifacts .get (0 ), this .outputFolder , true );
126137 DefaultFileMarkerHandler handler2 = new SourcesFileMarkerHandler (artifacts .get (0 ), this .outputFolder , false );
@@ -176,10 +187,12 @@ public void testMarkerFile() throws MojoExecutionException, IOException {
176187 assertFalse (outputFolder .exists ());
177188 }
178189
190+ @ Test
179191 public void testMarkerTimeStampResolved () throws MojoExecutionException , IOException , InterruptedException {
180192 doTestMarkerTimeStamp (true );
181193 }
182194
195+ @ Test
183196 public void testMarkerTimeStampUnResolved () throws MojoExecutionException , IOException , InterruptedException {
184197 doTestMarkerTimeStamp (false );
185198 }
@@ -220,6 +233,7 @@ public void doTestMarkerTimeStamp(boolean resolved)
220233 assertFalse (resolvedHandler .isMarkerSet ());
221234 }
222235
236+ @ Test
223237 public void testMarkerFileException () {
224238 // this stub wraps the file with an object to throw exceptions
225239 StubSourcesFileMarkerHandler handler =
@@ -231,13 +245,15 @@ public void testMarkerFileException() {
231245 }
232246 }
233247
248+ @ Test
234249 public void testMarkerFileResolvedSetter () {
235250 SourcesFileMarkerHandler handler = new SourcesFileMarkerHandler (null , null , true );
236251 assertTrue (handler .isResolved ());
237252 handler .setResolved (false );
238253 assertFalse (handler .isResolved ());
239254 }
240255
256+ @ Test
241257 public void testNullParent () throws MojoExecutionException {
242258 // the parent isn't set so this will create the marker in the local
243259 // folder. We must clear the
@@ -250,6 +266,7 @@ public void testNullParent() throws MojoExecutionException {
250266 assertFalse (handler .isMarkerSet ());
251267 }
252268
269+ @ Test
253270 public void testNullParentResolved () throws MojoExecutionException {
254271 // the parent isn't set so this will create the marker in the local
255272 // folder. We must clear the
0 commit comments