diff --git a/unit-tests-java8/src/test/java/org/eclipse/collections/test/OrderedIterableTestCase.java b/unit-tests-java8/src/test/java/org/eclipse/collections/test/OrderedIterableTestCase.java index 2f6c754094..2f42102cb5 100644 --- a/unit-tests-java8/src/test/java/org/eclipse/collections/test/OrderedIterableTestCase.java +++ b/unit-tests-java8/src/test/java/org/eclipse/collections/test/OrderedIterableTestCase.java @@ -34,13 +34,16 @@ public interface OrderedIterableTestCase extends RichIterableTestCase { + @Override + OrderedIterable newWith(T... elements); + /** * @since 9.1. */ @Test default void OrderedIterable_collectWithIndex() { - RichIterable> pairs = ((OrderedIterable) this.newWith(3, 2, 1, 0)) + RichIterable> pairs = this.newWith(3, 2, 1, 0) .collectWithIndex(PrimitiveTuples::pair); Assert.assertEquals( IntLists.mutable.with(0, 1, 2, 3), @@ -56,7 +59,7 @@ default void OrderedIterable_collectWithIndex() @Test default void OrderedIterable_collectWithIndexWithTarget() { - RichIterable> pairs = ((OrderedIterable) this.newWith(3, 2, 1, 0)) + RichIterable> pairs = this.newWith(3, 2, 1, 0) .collectWithIndex(PrimitiveTuples::pair, Lists.mutable.empty()); Assert.assertEquals( IntLists.mutable.with(0, 1, 2, 3), @@ -65,7 +68,7 @@ default void OrderedIterable_collectWithIndexWithTarget() Lists.mutable.with(3, 2, 1, 0), pairs.collect(ObjectIntPair::getOne, Lists.mutable.empty())); - RichIterable> setOfPairs = ((OrderedIterable) this.newWith(3, 2, 1, 0)) + RichIterable> setOfPairs = this.newWith(3, 2, 1, 0) .collectWithIndex(PrimitiveTuples::pair, Lists.mutable.empty()); Assert.assertEquals( IntSets.mutable.with(0, 1, 2, 3), @@ -84,19 +87,19 @@ default void OrderedIterable_getFirst() @Test default void OrderedIterable_getFirstOptional_empty() { - assertSame(Optional.empty(), ((OrderedIterable) this.newWith()).getFirstOptional()); + assertSame(Optional.empty(), this.newWith().getFirstOptional()); } @Test default void OrderedIterable_getFirstOptional() { - assertEquals(Optional.of(Integer.valueOf(3)), ((OrderedIterable) this.newWith(3, 3, 3, 2, 2, 1)).getFirstOptional()); + assertEquals(Optional.of(Integer.valueOf(3)), this.newWith(3, 3, 3, 2, 2, 1).getFirstOptional()); } @Test default void OrderedIterable_getFirstOptional_null_element() { - assertThrows(NullPointerException.class, () -> ((OrderedIterable) this.newWith(new Object[]{null})).getFirstOptional()); + assertThrows(NullPointerException.class, () -> this.newWith(new Object[]{null}).getFirstOptional()); } @Test @@ -108,19 +111,19 @@ default void OrderedIterable_getLast() @Test default void OrderedIterable_getLastOptional_empty() { - assertSame(Optional.empty(), ((OrderedIterable) this.newWith()).getLastOptional()); + assertSame(Optional.empty(), this.newWith().getLastOptional()); } @Test default void OrderedIterable_getLastOptional() { - assertEquals(Optional.of(Integer.valueOf(1)), ((OrderedIterable) this.newWith(3, 3, 3, 2, 2, 1)).getLastOptional()); + assertEquals(Optional.of(Integer.valueOf(1)), this.newWith(3, 3, 3, 2, 2, 1).getLastOptional()); } @Test(expected = NullPointerException.class) default void OrderedIterable_getLastOptional_null_element() { - ((OrderedIterable) this.newWith(new Object[]{null})).getLastOptional(); + this.newWith(new Object[]{null}).getLastOptional(); } @Test