ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/jtreg/util/Collections/EmptyCollectionSerialization.java
(Generate patch)

Comparing jsr166/src/test/jtreg/util/Collections/EmptyCollectionSerialization.java (file contents):
Revision 1.3 by jsr166, Wed Sep 9 22:05:28 2015 UTC vs.
Revision 1.5 by jsr166, Mon Jan 8 03:12:03 2018 UTC

# Line 29 | Line 29
29   * @run testng EmptyCollectionSerialization
30   */
31  
32 import java.util.*;
33 import java.util.function.Supplier;
34 import java.io.*;
35 import org.testng.annotations.Test;
32   import org.testng.annotations.DataProvider;
33 + import org.testng.annotations.Test;
34 +
35 + import java.io.ByteArrayInputStream;
36 + import java.io.ByteArrayOutputStream;
37 + import java.io.InputStream;
38 + import java.io.ObjectInputStream;
39 + import java.io.ObjectOutputStream;
40 + import java.util.Arrays;
41 + import java.util.Collection;
42 + import java.util.Collections;
43 + import java.util.Iterator;
44 + import java.util.function.Supplier;
45  
38 import static org.testng.Assert.fail;
46   import static org.testng.Assert.assertSame;
47 + import static org.testng.Assert.fail;
48  
49   public class EmptyCollectionSerialization {
50      private static Object patheticDeepCopy(Object o) throws Exception {
# Line 58 | Line 66 | public class EmptyCollectionSerializatio
66              Object singleton = o.get();
67              assertSame(o.get(), singleton, description + ": broken Supplier not returning singleton");
68              Object copy = patheticDeepCopy(singleton);
69 <            assertSame( copy, singleton, description + ": " +
69 >            assertSame(copy, singleton, description + ": " +
70                  copy.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(copy)) +
71                  " is not the singleton " +
72                  singleton.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(singleton)));
# Line 73 | Line 81 | public class EmptyCollectionSerializatio
81      }
82  
83      public static Collection<Object[]> makeSingletons() {
84 <        return Arrays.asList(
85 <            new Object[]{"Collections.EMPTY_LIST",
86 <                (Supplier) () -> {return Collections.EMPTY_LIST;}},
87 <            new Object[]{"Collections.EMPTY_MAP",
88 <                (Supplier) () -> {return Collections.EMPTY_MAP;}},
89 <            new Object[]{"Collections.EMPTY_SET",
90 <                (Supplier) () -> {return Collections.EMPTY_SET;}},
91 <            new Object[]{"Collections.singletonMap()",
92 <                (Supplier) () -> {return Collections.emptyList();}},
93 <            new Object[]{"Collections.emptyMap()",
94 <                (Supplier) () -> {return Collections.emptyMap();}},
95 <            new Object[]{"Collections.emptySet()",
96 <                (Supplier) () -> {return Collections.emptySet();}},
97 <            new Object[]{"Collections.emptySortedSet()",
98 <                (Supplier) () -> {return Collections.emptySortedSet();}},
99 <            new Object[]{"Collections.emptySortedMap()",
100 <                (Supplier) () -> {return Collections.emptySortedMap();}},
101 <            new Object[]{"Collections.emptyNavigableSet()",
102 <                (Supplier) () -> {return Collections.emptyNavigableSet();}},
103 <            new Object[]{"Collections.emptyNavigableMap()",
104 <                (Supplier) () -> {return Collections.emptyNavigableMap();}}
105 <            );
84 >        Object[][] params = {
85 >            {"Collections.EMPTY_LIST",
86 >             (Supplier) () -> Collections.EMPTY_LIST},
87 >            {"Collections.EMPTY_MAP",
88 >             (Supplier) () -> Collections.EMPTY_MAP},
89 >            {"Collections.EMPTY_SET",
90 >             (Supplier) () -> Collections.EMPTY_SET},
91 >            {"Collections.emptyList()",
92 >             (Supplier) () -> Collections.emptyList()},
93 >            {"Collections.emptyMap()",
94 >             (Supplier) () -> Collections.emptyMap()},
95 >            {"Collections.emptySet()",
96 >             (Supplier) () -> Collections.emptySet()},
97 >            {"Collections.emptySortedSet()",
98 >             (Supplier) () -> Collections.emptySortedSet()},
99 >            {"Collections.emptySortedMap()",
100 >             (Supplier) () -> Collections.emptySortedMap()},
101 >            {"Collections.emptyNavigableSet()",
102 >             (Supplier) () -> Collections.emptyNavigableSet()},
103 >            {"Collections.emptyNavigableMap()",
104 >             (Supplier) () -> Collections.emptyNavigableMap()},
105 >        };
106 >        return Arrays.asList(params);
107      }
108   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines