~ubuntu-branches/ubuntu/wily/gs-collections/wily

« back to all changes in this revision

Viewing changes to scala-unit-tests/src/test/scala/com/gs/collections/impl/SynchronizedCollectionTestTrait.scala

  • Committer: Package Import Robot
  • Author(s): Emmanuel Bourg
  • Date: 2015-07-23 12:42:30 UTC
  • Revision ID: package-import@ubuntu.com-20150723124230-2rjvfv6elyn2m7d4
Tags: upstream-5.1.0
ImportĀ upstreamĀ versionĀ 5.1.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2011 Goldman Sachs.
 
3
 *
 
4
 * Licensed under the Apache License, Version 2.0 (the "License");
 
5
 * you may not use this file except in compliance with the License.
 
6
 * You may obtain a copy of the License at
 
7
 *
 
8
 *     http://www.apache.org/licenses/LICENSE-2.0
 
9
 *
 
10
 * Unless required by applicable law or agreed to in writing, software
 
11
 * distributed under the License is distributed on an "AS IS" BASIS,
 
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
13
 * See the License for the specific language governing permissions and
 
14
 * limitations under the License.
 
15
 */
 
16
 
 
17
package com.gs.collections.impl
 
18
 
 
19
import list.mutable.FastList
 
20
import org.junit.Test
 
21
 
 
22
trait SynchronizedCollectionTestTrait extends SynchronizedTestTrait with IterableTestTrait
 
23
{
 
24
    val classUnderTest: java.util.Collection[String]
 
25
 
 
26
    @Test
 
27
    def size_synchronized
 
28
    {
 
29
        this.assertSynchronized
 
30
        {
 
31
            this.classUnderTest.size
 
32
        }
 
33
    }
 
34
 
 
35
    @Test
 
36
    def isEmpty_synchronized
 
37
    {
 
38
        this.assertSynchronized
 
39
        {
 
40
            this.classUnderTest.isEmpty
 
41
        }
 
42
    }
 
43
 
 
44
    @Test
 
45
    def contains_synchronized
 
46
    {
 
47
        this.assertSynchronized
 
48
        {
 
49
            this.classUnderTest.contains(null)
 
50
        }
 
51
    }
 
52
 
 
53
    @Test
 
54
    def iterator_not_synchronized
 
55
    {
 
56
        this.assertNotSynchronized
 
57
        {
 
58
            this.classUnderTest.iterator
 
59
        }
 
60
    }
 
61
 
 
62
    @Test
 
63
    def toArray_synchronized
 
64
    {
 
65
        this.assertSynchronized
 
66
        {
 
67
            this.classUnderTest.toArray
 
68
        }
 
69
    }
 
70
 
 
71
    @Test
 
72
    def toArray_with_target_synchronized
 
73
    {
 
74
        this.assertSynchronized
 
75
        {
 
76
            val array: Array[String] = null
 
77
            this.classUnderTest.toArray(array)
 
78
        }
 
79
    }
 
80
 
 
81
    @Test
 
82
    def add_synchronized
 
83
    {
 
84
        this.assertSynchronized
 
85
        {
 
86
            this.classUnderTest.add("")
 
87
        }
 
88
    }
 
89
 
 
90
    @Test
 
91
    def remove_synchronized
 
92
    {
 
93
        this.assertSynchronized
 
94
        {
 
95
            this.classUnderTest.remove("")
 
96
        }
 
97
    }
 
98
 
 
99
    @Test
 
100
    def containsAll_synchronized
 
101
    {
 
102
        this.assertSynchronized
 
103
        {
 
104
            this.classUnderTest.containsAll(FastList.newList[String])
 
105
        }
 
106
    }
 
107
 
 
108
    @Test
 
109
    def addAll_synchronized
 
110
    {
 
111
        this.assertSynchronized
 
112
        {
 
113
            this.classUnderTest.addAll(FastList.newList[String])
 
114
        }
 
115
    }
 
116
 
 
117
    @Test
 
118
    def removeAll_synchronized
 
119
    {
 
120
        this.assertSynchronized
 
121
        {
 
122
            this.classUnderTest.removeAll(FastList.newList[String])
 
123
        }
 
124
    }
 
125
 
 
126
    @Test
 
127
    def retainAll_synchronized
 
128
    {
 
129
        this.assertSynchronized
 
130
        {
 
131
            this.classUnderTest.retainAll(FastList.newList[String])
 
132
        }
 
133
    }
 
134
 
 
135
    @Test
 
136
    def clear_synchronized
 
137
    {
 
138
        this.assertSynchronized
 
139
        {
 
140
            this.classUnderTest.clear()
 
141
        }
 
142
    }
 
143
 
 
144
    @Test
 
145
    def equals_synchronized
 
146
    {
 
147
        this.assertNotSynchronized
 
148
        {
 
149
            this.classUnderTest.equals(null)
 
150
        }
 
151
    }
 
152
 
 
153
    @Test
 
154
    def hashCode_synchronized
 
155
    {
 
156
        this.assertNotSynchronized
 
157
        {
 
158
            this.classUnderTest.hashCode
 
159
        }
 
160
    }
 
161
}