8146209: java/net/NetworkInterface/NetworkInterfaceStreamTest.java still fails after fix JDK-8131155
authorxiaofeya
Mon, 28 Dec 2015 19:03:18 -0800
changeset 34834 8baf154e0db4
parent 34833 aca0e66389da
child 34835 ee52702b8d1b
8146209: java/net/NetworkInterface/NetworkInterfaceStreamTest.java still fails after fix JDK-8131155 Reviewed-by: chegar Contributed-by: felix.yang@oracle.com
jdk/test/java/net/NetworkInterface/NetworkInterfaceStreamTest.java
--- a/jdk/test/java/net/NetworkInterface/NetworkInterfaceStreamTest.java	Mon Dec 28 00:02:06 2015 +0000
+++ b/jdk/test/java/net/NetworkInterface/NetworkInterfaceStreamTest.java	Mon Dec 28 19:03:18 2015 -0800
@@ -85,13 +85,15 @@
     }
 
     private Stream<NetworkInterface> allNetworkInterfaces() throws SocketException {
-        return NetworkInterface.networkInterfaces().flatMap(this::allSubNetworkInterfaces);
+        return NetworkInterface.networkInterfaces()
+                .filter(ni -> isIncluded(ni))
+                .flatMap(this::allSubNetworkInterfaces);
     }
 
     private Stream<NetworkInterface> allSubNetworkInterfaces(NetworkInterface ni) {
         return Stream.concat(
                 Stream.of(ni),
-                ni.subInterfaces().flatMap(this::allSubNetworkInterfaces));
+                ni.subInterfaces().filter(sni -> isIncluded(sni)).flatMap(this::allSubNetworkInterfaces));
     }
 
     @Test
@@ -129,7 +131,9 @@
         Collection<NetworkInterface> nis = Collections.list(NetworkInterface.getNetworkInterfaces());
         Collection<InetAddress> expected = new ArrayList<>();
         for (NetworkInterface ni : nis) {
-            expected.addAll(Collections.list(ni.getInetAddresses()));
+            if (isIncluded(ni)) {
+                expected.addAll(Collections.list(ni.getInetAddresses()));
+            }
         }
         withData(TestData.Factory.ofSupplier("All inet addresses", ss))
                 .stream(s -> s)