1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.atlassian.jira.rest.client.api.domain;
18
19 import com.atlassian.jira.rest.client.TestUtil;
20 import org.junit.Assert;
21 import org.junit.Test;
22
23 import static com.atlassian.jira.rest.client.TestUtil.assertNotEquals;
24 import static com.atlassian.jira.rest.client.TestUtil.toUri;
25
26 public class PriorityTest {
27 private static final Priority P1 = new Priority(toUri("http://localhost/1"), 1L, "a", "#223344", "a description", toUri("http://localhost/2"));
28 private static final Priority P2 = new Priority(toUri("http://localhost/1"), 2L, "a", "#223344", "a description", toUri("http://localhost/2"));
29 private static final Priority P3 = new Priority(toUri("http://localhost/1"), 3L, "b", "#223344", "a description", toUri("http://localhost/2"));
30 private static final Priority P4 = new Priority(toUri("http://localhost/2"), 4L, "a", "#223344", "a description", toUri("http://localhost/2"));
31 private static final Priority P5 = new Priority(toUri("http://localhost/1"), 5L, "a", "#123344", "a description", toUri("http://localhost/2"));
32 private static final Priority P6 = new Priority(toUri("http://localhost/1"), 6L, "a", "#223344", "a description2", toUri("http://localhost/2"));
33 private static final Priority P7 = new Priority(toUri("http://localhost/1"), 7L, "a", "#223344", "a description", toUri("http://localhost/3"));
34
35
36 @Test
37 public void testEquals() throws Exception {
38 TestUtil.assertEqualsSymmetrical(P1, P2);
39 Assert.assertEquals(P1, P1);
40 assertNotEquals(P1, null);
41 assertNotEquals(P1, P3);
42 assertNotEquals(P1, P4);
43 assertNotEquals(P1, P5);
44 assertNotEquals(P1, P6);
45 assertNotEquals(P1, P7);
46 }
47
48 @Test
49 public void testHashCode() throws Exception {
50 Assert.assertEquals(P1.hashCode(), P2.hashCode());
51 }
52 }