Debian Codegraph @

scala-unit-tests/src/test/scala/org/eclipse/collections/impl/SynchronizedMutableMapScalaTest.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.MutableMap
14 import org.eclipse.collections.impl.Prelude._
15 import org.eclipse.collections.impl.block.factory.Functions
16 import org.eclipse.collections.impl.list.mutable.FastList
17 import org.eclipse.collections.impl.map.mutable.UnifiedMap
18 import org.eclipse.collections.impl.tuple.Tuples
19 import org.junit.Test
20
21 class SynchronizedMutableMapScalaTest extends SynchronizedMapIterableTestTrait
22 {
23 val classUnderTest: MutableMap[String, String] = UnifiedMap.newWithKeysValues("One", "1", "Two", "2", "Three", "3").asSynchronized()
24
25 @Test
26 def newEmpty_synchronized
27 {
28 this.assertSynchronized
29 {
30 this.classUnderTest.newEmpty
31 }
32 }
33
34 @Test
35 def removeKey_synchronized
36 {
37 this.assertSynchronized
38 {
39 this.classUnderTest.remove("1")
40 }
41 }
42
43 @Test
44 def getIfAbsentPut_synchronized
45 {
46 this.assertSynchronized
47 {
48 this.classUnderTest.getIfAbsentPut("Nine", () => "foo")
49 }
50 }
51
52 @Test
53 def getIfAbsentPutWith_synchronized
54 {
55 this.assertSynchronized
56 {
57 this.classUnderTest.getIfAbsentPutWith("Nine", Functions.getPassThru[String], "foo")
58 }
59 }
60
61 @Test
62 def withKeyValue_synchronized
63 {
64 this.assertSynchronized
65 {
66 this.classUnderTest.withKeyValue("foo", "bar")
67 }
68 }
69
70 @Test
71 def withAllKeyValues_synchronized
72 {
73 this.assertSynchronized
74 {
75 this.classUnderTest.withAllKeyValues(FastList.newListWith(Tuples.pair("foo", "bar")));
76 }
77 }
78
79 @Test
80 def withAllKeyValueArguments_synchronized
81 {
82 this.assertSynchronized
83 {
84 this.classUnderTest.withAllKeyValueArguments(Tuples.pair("foo", "bar"))
85 }
86 }
87
88 @Test
89 def withoutKey_synchronized
90 {
91 this.assertSynchronized
92 {
93 this.classUnderTest.withoutKey("foo")
94 }
95 }
96
97 @Test
98 def withoutAllKeys_synchronized
99 {
100 this.assertSynchronized
101 {
102 this.classUnderTest.withoutAllKeys(FastList.newListWith("foo"))
103 }
104 }
105
106 @Test
107 def asUnmodifiable_synchronized
108 {
109 this.assertSynchronized
110 {
111 this.classUnderTest.asUnmodifiable
112 }
113 }
114
115 @Test
116 def toImmutable_synchronized
117 {
118 this.assertSynchronized
119 {
120 this.classUnderTest.toImmutable
121 }
122 }
123
124 @Test
125 def collectKeysAndValues_synchronized
126 {
127 this.assertSynchronized
128 {
129 this.classUnderTest.collectKeysAndValues(FastList.newListWith[java.lang.Integer](4, 5, 6),
130 {
131 _: java.lang.Integer => ""
132 },
133 {
134 _: java.lang.Integer => ""
135 })
136 }
137 }
138
139 @Test
140 def keySet_synchronized
141 {
142 this.assertSynchronized
143 {
144 this.classUnderTest.keySet
145 }
146 }
147
148 @Test
149 def entrySet_synchronized
150 {
151 this.assertSynchronized
152 {
153 this.classUnderTest.entrySet
154 }
155 }
156 }