Debian Codegraph @

scala-unit-tests/src/test/scala/org/eclipse/collections/impl/SynchronizedMapIterableTestTrait.scala

raw
1 /*
2 * Copyright (c) 2021 Goldman Sachs.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * and Eclipse Distribution License v. 1.0 which accompany this distribution.
6 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7 * and the Eclipse Distribution License is available at
8 * http://www.eclipse.org/org/documents/edl-v10.php.
9 */
10
11 package org.eclipse.collections.impl
12
13 import org.eclipse.collections.api.map.MapIterable
14 import org.eclipse.collections.impl.Prelude._
15 import org.eclipse.collections.impl.tuple.Tuples
16 import org.junit.Test
17
18 trait SynchronizedMapIterableTestTrait extends SynchronizedRichIterableTestTrait
19 {
20 val classUnderTest: MapIterable[String, String]
21
22 @Test
23 def equals_synchronized
24 {
25 this.assertSynchronized
26 {
27 this.classUnderTest.equals(null)
28 }
29 }
30
31 @Test
32 def hashCode_synchronized
33 {
34 this.assertSynchronized
35 {
36 this.classUnderTest.hashCode
37 }
38 }
39
40 @Test
41 def get_synchronized
42 {
43 this.assertSynchronized
44 {
45 this.classUnderTest.get("1")
46 }
47 }
48
49 @Test
50 def containsKey_synchronized
51 {
52 this.assertSynchronized
53 {
54 this.classUnderTest.containsKey("One")
55 }
56 }
57
58 @Test
59 def containsValue_synchronized
60 {
61 this.assertSynchronized
62 {
63 this.classUnderTest.containsValue("2")
64 }
65 }
66
67 @Test
68 def forEachKey_synchronized
69 {
70 this.assertSynchronized
71 {
72 this.classUnderTest.forEachKey
73 {
74 _: String => ()
75 }
76 }
77 }
78
79 @Test
80 def forEachValue_synchronized
81 {
82 this.assertSynchronized
83 {
84 this.classUnderTest.forEachValue
85 {
86 _: String => ()
87 }
88 }
89 }
90
91 @Test
92 def forEachKeyValue_synchronized
93 {
94 this.assertSynchronized
95 {
96 this.classUnderTest.forEachKeyValue
97 {
98 (_: String, _: String) => ()
99 }
100 }
101 }
102
103 @Test
104 def getIfAbsent_synchronized
105 {
106 this.assertSynchronized
107 {
108 this.classUnderTest.getIfAbsent("Nine", () => "foo")
109 }
110 }
111
112 @Test
113 def getIfAbsentWith_synchronized
114 {
115 this.assertSynchronized
116 {
117 this.classUnderTest.getIfAbsentWith("Nine", (_: String) => "", "foo")
118 }
119 }
120
121 @Test
122 def ifPresentApply_synchronized
123 {
124 this.assertSynchronized
125 {
126 this.classUnderTest.ifPresentApply("1", (_: String) => "foo")
127 }
128 }
129
130 @Test
131 def keysView_synchronized
132 {
133 this.assertSynchronized
134 {
135 this.classUnderTest.keysView()
136 }
137 }
138
139 @Test
140 def valuesView_synchronized
141 {
142 this.assertSynchronized
143 {
144 this.classUnderTest.valuesView()
145 }
146 }
147
148 @Test
149 def mapSelect_synchronized
150 {
151 this.assertSynchronized
152 {
153 this.classUnderTest.select
154 {
155 (_: String, _: String) => false
156 }
157 }
158 }
159
160 @Test
161 def mapCollectValues_synchronized
162 {
163 this.assertSynchronized
164 {
165 this.classUnderTest.collectValues
166 {
167 (_: String, _: String) => "foo"
168 }
169 }
170 }
171
172 @Test
173 def mapCollect_synchronized
174 {
175 this.assertSynchronized
176 {
177 this.classUnderTest.collect
178 {
179 (_: String, _: String) => Tuples.pair("foo", "bar")
180 }
181 }
182 }
183
184 @Test
185 def mapReject_synchronized
186 {
187 this.assertSynchronized
188 {
189 this.classUnderTest.reject
190 {
191 (_: String, _: String) => false
192 }
193 }
194 }
195
196 @Test
197 def mapDetect_synchronized
198 {
199 this.assertSynchronized
200 {
201 this.classUnderTest.detect
202 {
203 (_: String, _: String) => false
204 }
205 }
206 }
207 }