test/java/net/NetworkInterface/Test.java
Print this page
*** 19,31 ****
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
! /* @test 01/02/14
! * @bug 4405354
! * @summary Exercise java.net.NetworkInterface
*/
import java.net.NetworkInterface;
import java.net.InetAddress;
import java.util.Enumeration;
--- 19,31 ----
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
! /* @test
! * @bug 4405354 6594296
! * @summary Basic tests for NetworkInterface
*/
import java.net.NetworkInterface;
import java.net.InetAddress;
import java.util.Enumeration;
*** 67,77 ****
--- 67,83 ----
System.out.println("equals() tests passed.");
if (ni2.hashCode() != ni.hashCode()) {
throw new Exception("hashCode contract broken");
}
System.out.println("hashCode() test passed.");
+
+ byte[] ba = ni.getHardwareAddress();
+ if (ba != null && ba.length == 0) {
+ throw new Exception("getHardwareAddress returned 0 length byte array");
}
+ System.out.println("getHardwareAddress() test passed.");
+ }
// misc tests :-
// getByXXX(null) should throw NPE
// getByXXX("garbage") should return null