提交 ea4b6b5c 编写于 作者: J Jesse Glick

JUnit 4.

上级 68842017
......@@ -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<? extends Run<?,?>.Artifact> createArtifactList(String... paths) throws Exception {
FreeStyleProject prj = createFreeStyleProject();
FreeStyleProject prj = j.createFreeStyleProject();
FreeStyleBuild r = prj.scheduleBuild2(0).get();
Run<FreeStyleProject,FreeStyleBuild>.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<? extends Run<?, ?>.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<? extends Run<?, ?>.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<? extends Run<?, ?>.Artifact> a = createArtifactList("a.xml","a/a.xml");
assertEquals(a.get(0).getDisplayPath(),"a.xml");
assertEquals(a.get(1).getDisplayPath(),"a/a.xml");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册