Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
DefaultComponentRoleTest | 31 | 16 | 0% | 1 | 0 | ||
DefaultComponentRoleTest.Role | 33 | 0 | - | 0 | 0 | ||
DefaultComponentRoleTest.OtherRole | 37 | 0 | - | 0 | 0 |
1 | /* | |
2 | * See the NOTICE file distributed with this work for additional | |
3 | * information regarding copyright ownership. | |
4 | * | |
5 | * This is free software; you can redistribute it and/or modify it | |
6 | * under the terms of the GNU Lesser General Public License as | |
7 | * published by the Free Software Foundation; either version 2.1 of | |
8 | * the License, or (at your option) any later version. | |
9 | * | |
10 | * This software is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | * Lesser General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU Lesser General Public | |
16 | * License along with this software; if not, write to the Free | |
17 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |
18 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | |
19 | */ | |
20 | package org.xwiki.component.descriptor; | |
21 | ||
22 | import org.junit.Assert; | |
23 | import org.junit.Test; | |
24 | ||
25 | /** | |
26 | * Unit tests for {@link DefaultComponentRole}. | |
27 | * | |
28 | * @version $Id: c5ecc16a1a24d40d1c369319b3f4ca330db0013b $ | |
29 | * @since 3.3M1 | |
30 | */ | |
31 | public class DefaultComponentRoleTest | |
32 | { | |
33 | private interface Role | |
34 | { | |
35 | } | |
36 | ||
37 | private interface OtherRole | |
38 | { | |
39 | } | |
40 | ||
41 | 1 | @Test |
42 | public void equals() | |
43 | { | |
44 | 1 | DefaultComponentRole cr1 = new DefaultComponentRole(); |
45 | 1 | cr1.setRoleType(Role.class); |
46 | 1 | cr1.setRoleHint("hint"); |
47 | ||
48 | 1 | Assert.assertEquals(cr1, cr1); |
49 | ||
50 | 1 | DefaultComponentRole cr2 = new DefaultComponentRole(); |
51 | 1 | cr2.setRoleType(Role.class); |
52 | 1 | cr2.setRoleHint("hint"); |
53 | ||
54 | 1 | Assert.assertEquals(cr1, cr2); |
55 | ||
56 | 1 | DefaultComponentRole cr3 = new DefaultComponentRole(); |
57 | 1 | cr3.setRoleType(Role.class); |
58 | 1 | cr3.setRoleHint("other"); |
59 | ||
60 | 1 | Assert.assertFalse(cr1.equals(cr3)); |
61 | ||
62 | 1 | DefaultComponentRole cr4 = new DefaultComponentRole(); |
63 | 1 | cr4.setRoleType(OtherRole.class); |
64 | 1 | cr4.setRoleHint("hint"); |
65 | ||
66 | 1 | Assert.assertFalse(cr1.equals(cr4)); |
67 | } | |
68 | } |