File D:\maven-qcr-plugin-testsunitaires\qcr4java\jenkins-master\target\site\qc\core\src\test\java\hudson\model\JobTest.java.html

1 package hudson.model;
2
3
4 import junit.framework.Assert;
5
6 import org.junit.Test;
7 import org.kohsuke.stapler.StaplerRequest;
8 import org.mockito.Mockito;
9
10 public class JobTest {
11
12 private final String DISPLAY_NAME_PARAMETER_NAME = "displayName";
13
14
15 @Test
16 public void testSetDisplayName() throws Exception {
17 final String displayName = "testSetDisplayName";
18
19 StubJob j = new StubJob();
20 // call setDisplayNameFromRequest
21 j.setDisplayNameOrNull(displayName);
22
23 // make sure the displayname has been set
24 Assert.assertEquals(displayName, j.getDisplayName());
25 }
26
27 @Test
28 public void testSetDisplayNameZeroLength() throws Exception {
29 StubJob j = new StubJob();
30 // call setDisplayNameFromRequest
31 j.setDisplayNameOrNull("");
32
33 // make sure the getDisplayName returns the project name
34 Assert.assertEquals(StubJob.DEFAULT_STUB_JOB_NAME, j.getDisplayName());
35 }
36 }
37