| 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.stack.mutable |
| 12 |
|
| 13 |
import org.eclipse.collections.impl.SynchronizedRichIterableTestTrait |
| 14 |
import org.junit.Test |
| 15 |
|
| 16 |
class SynchronizedStackScalaTest extends SynchronizedRichIterableTestTrait |
| 17 |
{ |
| 18 |
val classUnderTest = ArrayStack.newStackFromTopToBottom[String]("1", "2", "3").asSynchronized |
| 19 |
|
| 20 |
@Test |
| 21 |
def equals_synchronized |
| 22 |
{ |
| 23 |
this.assertSynchronized |
| 24 |
{ |
| 25 |
this.classUnderTest.equals(null) |
| 26 |
} |
| 27 |
} |
| 28 |
|
| 29 |
@Test |
| 30 |
def hashCode_synchronized |
| 31 |
{ |
| 32 |
this.assertSynchronized |
| 33 |
{ |
| 34 |
this.classUnderTest.hashCode |
| 35 |
} |
| 36 |
} |
| 37 |
|
| 38 |
@Test |
| 39 |
def push |
| 40 |
{ |
| 41 |
this.assertSynchronized |
| 42 |
{ |
| 43 |
this.classUnderTest.push("4") |
| 44 |
} |
| 45 |
} |
| 46 |
|
| 47 |
@Test |
| 48 |
def pop |
| 49 |
{ |
| 50 |
this.assertSynchronized |
| 51 |
{ |
| 52 |
this.classUnderTest.pop |
| 53 |
} |
| 54 |
} |
| 55 |
|
| 56 |
@Test |
| 57 |
def pop_int |
| 58 |
{ |
| 59 |
this.assertSynchronized |
| 60 |
{ |
| 61 |
this.classUnderTest.pop(2) |
| 62 |
} |
| 63 |
} |
| 64 |
|
| 65 |
@Test |
| 66 |
def peek |
| 67 |
{ |
| 68 |
this.assertSynchronized |
| 69 |
{ |
| 70 |
this.classUnderTest.peek() |
| 71 |
} |
| 72 |
} |
| 73 |
|
| 74 |
@Test |
| 75 |
def peek_int |
| 76 |
{ |
| 77 |
this.assertSynchronized |
| 78 |
{ |
| 79 |
this.classUnderTest.peek(2) |
| 80 |
} |
| 81 |
} |
| 82 |
|
| 83 |
@Test |
| 84 |
def clear |
| 85 |
{ |
| 86 |
this.assertSynchronized |
| 87 |
{ |
| 88 |
this.classUnderTest.clear |
| 89 |
} |
| 90 |
} |
| 91 |
|
| 92 |
@Test |
| 93 |
def to_immutable |
| 94 |
{ |
| 95 |
this.assertSynchronized |
| 96 |
{ |
| 97 |
this.classUnderTest.toImmutable |
| 98 |
} |
| 99 |
} |
| 100 |
} |