|
16 | 16 |
|
17 | 17 | package com.google.common.collect.testing.testers; |
18 | 18 |
|
19 | | -import static com.google.common.collect.testing.Helpers.getMethod; |
20 | | - |
21 | 19 | import com.google.common.annotations.GwtCompatible; |
22 | | -import com.google.common.annotations.GwtIncompatible; |
23 | | -import com.google.common.annotations.J2ktIncompatible; |
24 | 20 | import com.google.common.collect.testing.AbstractMapTester; |
25 | | -import java.lang.reflect.Method; |
26 | 21 | import java.util.Spliterator; |
27 | 22 | import java.util.concurrent.ConcurrentMap; |
28 | 23 | import org.jspecify.annotations.NullMarked; |
|
32 | 27 | * A generic JUnit test which tests spliterator characteristics on concurrent map views. Verifies |
33 | 28 | * that {@link ConcurrentMap} implementations return spliterators with the {@link |
34 | 29 | * Spliterator#CONCURRENT} characteristic on their {@code entrySet()}, {@code keySet()}, and {@code |
35 | | - * values()} views, and that no spliterator reports both {@code CONCURRENT} and {@code SIZED} |
36 | | - * characteristics (which are mutually incompatible per the Java specification). |
| 30 | + * values()} views. |
37 | 31 | * |
38 | 32 | * <p>Can't be invoked directly; please see {@link |
39 | 33 | * com.google.common.collect.testing.ConcurrentMapTestSuiteBuilder}. |
40 | 34 | * |
41 | 35 | * @author Guava Authors |
42 | 36 | */ |
43 | | -@GwtCompatible(emulated = true) |
| 37 | +@GwtCompatible |
44 | 38 | @Ignore("test runners must not instantiate and run this directly, only via suites we build") |
45 | 39 | // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. |
46 | 40 | @SuppressWarnings("JUnit4ClassUsedInJUnit3") |
@@ -83,84 +77,4 @@ public void testValuesSpliteratorHasConcurrent() { |
83 | 77 | "values().spliterator() should have CONCURRENT characteristic", |
84 | 78 | spliterator.hasCharacteristics(Spliterator.CONCURRENT)); |
85 | 79 | } |
86 | | - |
87 | | - /** |
88 | | - * Tests that the spliterator returned by {@code entrySet().spliterator()} does not have both |
89 | | - * {@code CONCURRENT} and {@code SIZED} characteristics, which are mutually incompatible per the |
90 | | - * Java specification. |
91 | | - */ |
92 | | - public void testEntrySetSpliteratorNotConcurrentAndSized() { |
93 | | - Spliterator<?> spliterator = getMap().entrySet().spliterator(); |
94 | | - assertFalse( |
95 | | - "entrySet().spliterator() should not have both CONCURRENT and SIZED characteristics", |
96 | | - spliterator.hasCharacteristics(Spliterator.CONCURRENT) |
97 | | - && spliterator.hasCharacteristics(Spliterator.SIZED)); |
98 | | - } |
99 | | - |
100 | | - /** |
101 | | - * Tests that the spliterator returned by {@code keySet().spliterator()} does not have both {@code |
102 | | - * CONCURRENT} and {@code SIZED} characteristics, which are mutually incompatible per the Java |
103 | | - * specification. |
104 | | - */ |
105 | | - public void testKeySetSpliteratorNotConcurrentAndSized() { |
106 | | - Spliterator<?> spliterator = getMap().keySet().spliterator(); |
107 | | - assertFalse( |
108 | | - "keySet().spliterator() should not have both CONCURRENT and SIZED characteristics", |
109 | | - spliterator.hasCharacteristics(Spliterator.CONCURRENT) |
110 | | - && spliterator.hasCharacteristics(Spliterator.SIZED)); |
111 | | - } |
112 | | - |
113 | | - /** |
114 | | - * Tests that the spliterator returned by {@code values().spliterator()} does not have both {@code |
115 | | - * CONCURRENT} and {@code SIZED} characteristics, which are mutually incompatible per the Java |
116 | | - * specification. |
117 | | - */ |
118 | | - public void testValuesSpliteratorNotConcurrentAndSized() { |
119 | | - Spliterator<?> spliterator = getMap().values().spliterator(); |
120 | | - assertFalse( |
121 | | - "values().spliterator() should not have both CONCURRENT and SIZED characteristics", |
122 | | - spliterator.hasCharacteristics(Spliterator.CONCURRENT) |
123 | | - && spliterator.hasCharacteristics(Spliterator.SIZED)); |
124 | | - } |
125 | | - |
126 | | - // Reflection methods for test suppression |
127 | | - |
128 | | - @J2ktIncompatible |
129 | | - @GwtIncompatible // reflection |
130 | | - public static Method getEntrySetSpliteratorHasConcurrentMethod() { |
131 | | - return getMethod(ConcurrentMapSpliteratorTester.class, "testEntrySetSpliteratorHasConcurrent"); |
132 | | - } |
133 | | - |
134 | | - @J2ktIncompatible |
135 | | - @GwtIncompatible // reflection |
136 | | - public static Method getKeySetSpliteratorHasConcurrentMethod() { |
137 | | - return getMethod(ConcurrentMapSpliteratorTester.class, "testKeySetSpliteratorHasConcurrent"); |
138 | | - } |
139 | | - |
140 | | - @J2ktIncompatible |
141 | | - @GwtIncompatible // reflection |
142 | | - public static Method getValuesSpliteratorHasConcurrentMethod() { |
143 | | - return getMethod(ConcurrentMapSpliteratorTester.class, "testValuesSpliteratorHasConcurrent"); |
144 | | - } |
145 | | - |
146 | | - @J2ktIncompatible |
147 | | - @GwtIncompatible // reflection |
148 | | - public static Method getEntrySetSpliteratorNotConcurrentAndSizedMethod() { |
149 | | - return getMethod( |
150 | | - ConcurrentMapSpliteratorTester.class, "testEntrySetSpliteratorNotConcurrentAndSized"); |
151 | | - } |
152 | | - |
153 | | - @J2ktIncompatible |
154 | | - @GwtIncompatible // reflection |
155 | | - public static Method getKeySetSpliteratorNotConcurrentAndSizedMethod() { |
156 | | - return getMethod( |
157 | | - ConcurrentMapSpliteratorTester.class, "testKeySetSpliteratorNotConcurrentAndSized"); |
158 | | - } |
159 | | - |
160 | | - @J2ktIncompatible |
161 | | - @GwtIncompatible // reflection |
162 | | - public static Method getValuesSpliteratorNotConcurrentAndSizedMethod() { |
163 | | - return getMethod( |
164 | | - ConcurrentMapSpliteratorTester.class, "testValuesSpliteratorNotConcurrentAndSized"); |
165 | | - } |
166 | 80 | } |
0 commit comments