From ea4b6b5cc81fc034f6c43aefd4f6b5651530547e Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Mon, 13 May 2013 13:06:29 -0400 Subject: [PATCH] JUnit 4. --- test/src/test/java/hudson/model/RunTest.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/test/src/test/java/hudson/model/RunTest.java b/test/src/test/java/hudson/model/RunTest.java index 23f895f22a..73429e01e9 100644 --- a/test/src/test/java/hudson/model/RunTest.java +++ b/test/src/test/java/hudson/model/RunTest.java @@ -23,16 +23,22 @@ */ package hudson.model; -import org.jvnet.hudson.test.HudsonTestCase; +import static org.junit.Assert.*; import java.util.List; +import org.junit.Rule; +import org.junit.Test; +import org.jvnet.hudson.test.JenkinsRule; /** * @author Kohsuke Kawaguchi */ -public class RunTest extends HudsonTestCase { +public class RunTest { + + @Rule public JenkinsRule j = new JenkinsRule(); + private List.Artifact> createArtifactList(String... paths) throws Exception { - FreeStyleProject prj = createFreeStyleProject(); + FreeStyleProject prj = j.createFreeStyleProject(); FreeStyleBuild r = prj.scheduleBuild2(0).get(); Run.ArtifactList list = r.new ArtifactList(); for (String p : paths) { @@ -42,21 +48,21 @@ public class RunTest extends HudsonTestCase { return list; } - public void testArtifactListDisambiguation1() throws Exception { + @Test public void artifactListDisambiguation1() throws Exception { List.Artifact> a = createArtifactList("a/b/c.xml", "d/f/g.xml", "h/i/j.xml"); assertEquals(a.get(0).getDisplayPath(),"c.xml"); assertEquals(a.get(1).getDisplayPath(),"g.xml"); assertEquals(a.get(2).getDisplayPath(),"j.xml"); } - public void testArtifactListDisambiguation2() throws Exception { + @Test public void artifactListDisambiguation2() throws Exception { List.Artifact> a = createArtifactList("a/b/c.xml", "d/f/g.xml", "h/i/g.xml"); assertEquals(a.get(0).getDisplayPath(),"c.xml"); assertEquals(a.get(1).getDisplayPath(),"f/g.xml"); assertEquals(a.get(2).getDisplayPath(),"i/g.xml"); } - public void testArtifactListDisambiguation3() throws Exception { + @Test public void artifactListDisambiguation3() throws Exception { List.Artifact> a = createArtifactList("a.xml","a/a.xml"); assertEquals(a.get(0).getDisplayPath(),"a.xml"); assertEquals(a.get(1).getDisplayPath(),"a/a.xml"); -- GitLab