| 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.InternalIterable |
| 14 |
import org.eclipse.collections.impl.Prelude._ |
| 15 |
import org.junit.Test |
| 16 |
|
| 17 |
trait SynchronizedMutableIterableTestTrait extends SynchronizedTestTrait with InternalIterableTestTrait |
| 18 |
{ |
| 19 |
val classUnderTest: InternalIterable[String] |
| 20 |
|
| 21 |
@Test |
| 22 |
def iterator_not_synchronized |
| 23 |
{ |
| 24 |
this.assertNotSynchronized |
| 25 |
{ |
| 26 |
val iterator = this.classUnderTest.iterator |
| 27 |
iterator.hasNext |
| 28 |
iterator.next |
| 29 |
} |
| 30 |
} |
| 31 |
|
| 32 |
@Test |
| 33 |
def forEach_synchronized |
| 34 |
{ |
| 35 |
this.assertSynchronized |
| 36 |
{ |
| 37 |
this.classUnderTest.forEach |
| 38 |
{ |
| 39 |
_: String => () |
| 40 |
} |
| 41 |
} |
| 42 |
} |
| 43 |
|
| 44 |
@Test |
| 45 |
def forEachWithIndex_synchronized |
| 46 |
{ |
| 47 |
this.assertSynchronized |
| 48 |
{ |
| 49 |
this.classUnderTest.forEachWithIndex |
| 50 |
{ |
| 51 |
(_: String, index: Int) => () |
| 52 |
} |
| 53 |
} |
| 54 |
} |
| 55 |
|
| 56 |
@Test |
| 57 |
def forEachWith_synchronized |
| 58 |
{ |
| 59 |
this.assertSynchronized |
| 60 |
{ |
| 61 |
this.classUnderTest.forEachWith( |
| 62 |
(_: String, parameter: String) => (), |
| 63 |
"!") |
| 64 |
} |
| 65 |
} |
| 66 |
} |