|
18 | 18 | .
|
19 | 19 | . The ArrayList8Test Class was Coded by : Alexandre BOLOT
|
20 | 20 | .
|
21 |
| - . Last Modified : 16/03/18 09:08 |
| 21 | + . Last Modified : 16/03/18 14:59 |
22 | 22 | .
|
23 | 23 |
|
24 | 24 | ...............................................................................................................................*/
|
@@ -723,6 +723,42 @@ public void map_Null ()
|
723 | 723 | }
|
724 | 724 | //endregion
|
725 | 725 |
|
| 726 | + //region --------------- map (x3) ------------------------ |
| 727 | + @Test |
| 728 | + public void mapAndCollect_Right () |
| 729 | + { |
| 730 | + for (int i = 0; i < 2000; i++) |
| 731 | + { |
| 732 | + ArrayList8<TestObject> list1 = new ArrayList8<TestObject>() |
| 733 | + {{ |
| 734 | + IntStream.range(0, randDelta(10, 5)).forEach(i -> add(randTestObject())); |
| 735 | + }}; |
| 736 | + |
| 737 | + ArrayList8<Integer> collect = list1.mapAndCollect(testObject -> testObject.val1); |
| 738 | + |
| 739 | + IntStream.range(0, list1.size()).forEach(index -> assertEquals(list1.get(index).val1, collect.get(index), 0.0001)); |
| 740 | + } |
| 741 | + } |
| 742 | + |
| 743 | + @Test |
| 744 | + public void mapAndCollect_Empty () |
| 745 | + { |
| 746 | + ArrayList8<TestObject> list1 = new ArrayList8<>(); |
| 747 | + |
| 748 | + ArrayList8<Integer> collect = list1.mapAndCollect(testObject -> testObject.val1); |
| 749 | + |
| 750 | + IntStream.range(0, list1.size()).forEach(i -> assertEquals(list1.get(i).val1, collect.get(i), 0.0001)); |
| 751 | + } |
| 752 | + |
| 753 | + @Test (expected = IllegalArgumentException.class) |
| 754 | + public void mapAndCollect_Null () |
| 755 | + { |
| 756 | + ArrayList8<TestObject> list1 = new ArrayList8<>(); |
| 757 | + |
| 758 | + list1.mapAndCollect(null); |
| 759 | + } |
| 760 | + //endregion |
| 761 | + |
726 | 762 | //region --------------- OtherMethods --------------------
|
727 | 763 | @NotNull
|
728 | 764 | private TestObject randTestObject ()
|
|
0 commit comments