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

1 package hudson.model;
2
3 import org.jvnet.hudson.test.Bug;
4 import org.jvnet.hudson.test.HudsonTestCase;
5 import org.jvnet.hudson.test.TestExtension;
6
7 /**
8 * @author Kohsuke Kawaguchi
9 */
10 public class UserPropertyTest extends HudsonTestCase {
11 @Bug(9062)
12 public void test9062() throws Exception {
13 User u = User.get("foo");
14 u.addProperty(new UserProperty1());
15 configRoundtrip(u);
16 for (UserProperty p : u.getAllProperties())
17 assertNotNull(p);
18 }
19
20 public static class UserProperty1 extends UserProperty {
21 @TestExtension
22 public static class DescriptorImpl extends UserPropertyDescriptor {
23 public String getDisplayName() {
24 return "UserProperty1";
25 }
26
27 @Override
28 public UserProperty newInstance(User user) {
29 return new UserProperty1();
30 }
31 }
32 }
33
34 public static class UserProperty2 extends UserProperty {
35 @TestExtension
36 public static class DescriptorImpl extends UserPropertyDescriptor {
37 public String getDisplayName() {
38 return "UserProperty2";
39 }
40
41 @Override
42 public boolean isEnabled() {
43 return false;
44 }
45
46 @Override
47 public UserProperty newInstance(User user) {
48 return new UserProperty1();
49 }
50 }
51 }
52 }
53