Renamed unit tests for ConcurrentModificationUnit
This commit is contained in:
parent
c40d6962dd
commit
0a444d32cf
@ -12,7 +12,7 @@ import static org.assertj.core.util.Lists.newArrayList;
|
|||||||
|
|
||||||
public class ConcurrentModificationUnitTest {
|
public class ConcurrentModificationUnitTest {
|
||||||
@Test(expected = ConcurrentModificationException.class)
|
@Test(expected = ConcurrentModificationException.class)
|
||||||
public void whilstRemovingDuringIteration_shouldThrowException() throws InterruptedException {
|
public void givenIterating_whenRemoving_thenThrowException() throws InterruptedException {
|
||||||
|
|
||||||
ArrayList<Integer> integers = newArrayList(1, 2, 3);
|
ArrayList<Integer> integers = newArrayList(1, 2, 3);
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ public class ConcurrentModificationUnitTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whilstRemovingDuringIteration_shouldNotThrowException() throws InterruptedException {
|
public void givenIterating_whenUsingIteratorRemove_thenDontError() throws InterruptedException {
|
||||||
|
|
||||||
ArrayList<Integer> integers = newArrayList(1, 2, 3);
|
ArrayList<Integer> integers = newArrayList(1, 2, 3);
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ public class ConcurrentModificationUnitTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whilstRemovingDuringForEach_shouldNotThrowException() throws InterruptedException {
|
public void givenIterating_whenUsingRemovalList_thenDontError() throws InterruptedException {
|
||||||
|
|
||||||
ArrayList<Integer> integers = newArrayList(1, 2, 3);
|
ArrayList<Integer> integers = newArrayList(1, 2, 3);
|
||||||
ArrayList<Integer> toRemove = newArrayList();
|
ArrayList<Integer> toRemove = newArrayList();
|
||||||
@ -51,4 +51,14 @@ public class ConcurrentModificationUnitTest {
|
|||||||
|
|
||||||
assertThat(integers).containsExactly(1, 3);
|
assertThat(integers).containsExactly(1, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenUsingRemoveIf_thenRemoveElements() throws InterruptedException {
|
||||||
|
|
||||||
|
ArrayList<Integer> integers = newArrayList(1, 2, 3);
|
||||||
|
|
||||||
|
integers.removeIf((i) -> i == 2);
|
||||||
|
|
||||||
|
assertThat(integers).containsExactly(1, 3);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user