|
18 | 18 | */
|
19 | 19 |
|
20 | 20 | /*
|
| 21 | + * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. |
21 | 22 | * Copyright (c) 2018, Chris Fraire <[email protected]>.
|
22 | 23 | */
|
23 | 24 | package org.opengrok.indexer.analysis;
|
|
32 | 33 | /**
|
33 | 34 | * Represents a container for tests of {@link PendingToken}.
|
34 | 35 | */
|
35 |
| -public class PendingTokenTest { |
| 36 | +class PendingTokenTest { |
36 | 37 |
|
37 | 38 | @Test
|
38 |
| - public void testEquals1() { |
| 39 | + void testEquals1() { |
39 | 40 | PendingToken instance = new PendingToken("", 0, 0);
|
40 | 41 | boolean result = instance.equals(instance);
|
41 | 42 | assertTrue(result, "PendingToken instance equals itself");
|
42 | 43 | }
|
43 | 44 |
|
44 | 45 | @Test
|
45 |
| - public void testEquals2() { |
| 46 | + void testEquals2() { |
46 | 47 | PendingToken instance1 = new PendingToken("a", 0, 1);
|
47 |
| - assertFalse(instance1.nonpos, "PendingToken default nonpos"); |
48 |
| - |
49 | 48 | PendingToken instance2 = new PendingToken("a", 0, 1);
|
50 |
| - instance2.nonpos = true; |
51 | 49 | boolean result = instance1.equals(instance2);
|
52 |
| - assertTrue(result, "PendingToken instance equivalence ignores nonpos"); |
| 50 | + assertTrue(result, "PendingToken instance equivalence false"); |
53 | 51 | }
|
54 | 52 |
|
55 | 53 | @Test
|
56 |
| - public void testNotEquals1() { |
| 54 | + void testNotEquals1() { |
57 | 55 | PendingToken instance1 = new PendingToken("", 0, 0);
|
58 | 56 | PendingToken instance2 = new PendingToken("", 0, 1); // nonsense but ok
|
59 | 57 | boolean result = instance1.equals(instance2);
|
60 | 58 | assertFalse(result, "PendingToken equals() only 2 immutables match");
|
61 | 59 | }
|
62 | 60 |
|
63 | 61 | @Test
|
64 |
| - public void testNotEquals2() { |
| 62 | + void testNotEquals2() { |
65 | 63 | PendingToken instance1 = new PendingToken("", 0, 0);
|
66 | 64 | PendingToken instance2 = new PendingToken("", 1, 0); // nonsense but ok
|
67 | 65 | boolean result = instance1.equals(instance2);
|
68 | 66 | assertFalse(result, "PendingToken equals() only 2 immutables match");
|
69 | 67 | }
|
70 | 68 |
|
71 | 69 | @Test
|
72 |
| - public void testNotEquals3() { |
| 70 | + void testNotEquals3() { |
73 | 71 | PendingToken instance1 = new PendingToken("", 0, 0);
|
74 | 72 | PendingToken instance2 = new PendingToken("a", 0, 0); // nonsense but ok
|
75 | 73 | boolean result = instance1.equals(instance2);
|
76 | 74 | assertFalse(result, "PendingToken equals() only 2 immutables match");
|
77 | 75 | }
|
78 | 76 |
|
79 | 77 | @Test
|
80 |
| - public void testSameHashCodes() { |
| 78 | + void testSameHashCodes() { |
81 | 79 | PendingToken instance1 = new PendingToken("a", 0, 1);
|
82 |
| - assertFalse(instance1.nonpos, "PendingToken default nonpos"); |
83 |
| - |
84 | 80 | PendingToken instance2 = new PendingToken("a", 0, 1);
|
85 |
| - instance2.nonpos = true; |
86 |
| - assertEquals(instance1.hashCode(), instance2.hashCode(), "PendingToken instance HashCode ignores nonpos"); |
| 81 | + assertEquals(instance1.hashCode(), instance2.hashCode(), "PendingToken instance HashCode differs"); |
87 | 82 | }
|
88 | 83 |
|
89 | 84 | @Test
|
90 |
| - public void testDifferentHashCodes1() { |
| 85 | + void testDifferentHashCodes1() { |
91 | 86 | PendingToken instance1 = new PendingToken("", 0, 0);
|
92 | 87 | PendingToken instance2 = new PendingToken("", 0, 1); // nonsense but ok
|
93 | 88 | assertNotEquals(instance1.hashCode(), instance2.hashCode(), "PendingToken hashCode() only 2 immutables match");
|
94 | 89 | }
|
95 | 90 |
|
96 | 91 | @Test
|
97 |
| - public void testDifferentHashCodes2() { |
| 92 | + void testDifferentHashCodes2() { |
98 | 93 | PendingToken instance1 = new PendingToken("", 0, 0);
|
99 | 94 | PendingToken instance2 = new PendingToken("", 1, 0); // nonsense but ok
|
100 | 95 | assertNotEquals(instance1.hashCode(), instance2.hashCode(), "PendingToken hashCode() only 2 immutables match");
|
101 | 96 | }
|
102 | 97 |
|
103 | 98 | @Test
|
104 |
| - public void testDifferentHashCodes3() { |
| 99 | + void testDifferentHashCodes3() { |
105 | 100 | PendingToken instance1 = new PendingToken("", 0, 0);
|
106 | 101 | PendingToken instance2 = new PendingToken("a", 0, 0); // nonsense but ok
|
107 | 102 | assertNotEquals(instance1.hashCode(), instance2.hashCode(), "PendingToken hashCode() only 2 immutables match");
|
108 | 103 | }
|
109 | 104 |
|
110 | 105 | @Test
|
111 |
| - public void testToString() { |
| 106 | + void testToString() { |
112 | 107 | PendingToken instance = new PendingToken("abc", 0, 4);
|
113 |
| - String expResult = "PendingToken{abc<<< start=0,end=4,nonpos=false}"; |
| 108 | + String expResult = "PendingToken{abc<<< start=0,end=4}"; |
114 | 109 | String result = instance.toString();
|
115 | 110 | assertEquals(expResult, result, "PendingToken toString()");
|
116 |
| - |
117 |
| - instance.nonpos = true; |
118 |
| - expResult = "PendingToken{abc<<< start=0,end=4,nonpos=true}"; |
119 |
| - result = instance.toString(); |
120 |
| - assertEquals(expResult, result, "PendingToken toString()"); |
121 | 111 | }
|
122 | 112 | }
|
0 commit comments