Debian Codegraph @

scala-unit-tests/src/test/scala/org/eclipse/collections/impl/SynchronizedCollectionTestTrait.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.impl.list.mutable.FastList
14 import org.junit.Test
15
16 trait SynchronizedCollectionTestTrait extends SynchronizedTestTrait with IterableTestTrait
17 {
18 val classUnderTest: java.util.Collection[String]
19
20 @Test
21 def size_synchronized
22 {
23 this.assertSynchronized
24 {
25 this.classUnderTest.size
26 }
27 }
28
29 @Test
30 def isEmpty_synchronized
31 {
32 this.assertSynchronized
33 {
34 this.classUnderTest.isEmpty
35 }
36 }
37
38 @Test
39 def contains_synchronized
40 {
41 this.assertSynchronized
42 {
43 this.classUnderTest.contains(null)
44 }
45 }
46
47 @Test
48 def iterator_not_synchronized
49 {
50 this.assertNotSynchronized
51 {
52 this.classUnderTest.iterator
53 }
54 }
55
56 @Test
57 def toArray_synchronized
58 {
59 this.assertSynchronized
60 {
61 this.classUnderTest.toArray
62 }
63 }
64
65 @Test
66 def toArray_with_target_synchronized
67 {
68 this.assertSynchronized
69 {
70 val array: Array[String] = null
71 this.classUnderTest.toArray(array)
72 }
73 }
74
75 @Test
76 def add_synchronized
77 {
78 this.assertSynchronized
79 {
80 this.classUnderTest.add("")
81 }
82 }
83
84 @Test
85 def remove_synchronized
86 {
87 this.assertSynchronized
88 {
89 this.classUnderTest.remove("")
90 }
91 }
92
93 @Test
94 def containsAll_synchronized
95 {
96 this.assertSynchronized
97 {
98 this.classUnderTest.containsAll(FastList.newList[String])
99 }
100 }
101
102 @Test
103 def addAll_synchronized
104 {
105 this.assertSynchronized
106 {
107 this.classUnderTest.addAll(FastList.newList[String])
108 }
109 }
110
111 @Test
112 def removeAll_synchronized
113 {
114 this.assertSynchronized
115 {
116 this.classUnderTest.removeAll(FastList.newList[String])
117 }
118 }
119
120 @Test
121 def retainAll_synchronized
122 {
123 this.assertSynchronized
124 {
125 this.classUnderTest.retainAll(FastList.newList[String])
126 }
127 }
128
129 @Test
130 def clear_synchronized
131 {
132 this.assertSynchronized
133 {
134 this.classUnderTest.clear()
135 }
136 }
137
138 @Test
139 def equals_synchronized
140 {
141 this.assertSynchronized
142 {
143 this.classUnderTest.equals(null)
144 }
145 }
146
147 @Test
148 def hashCode_synchronized
149 {
150 this.assertSynchronized
151 {
152 this.classUnderTest.hashCode
153 }
154 }
155 }