Package com.fasterxml.uuid

Examples of com.fasterxml.uuid.EthernetAddress.toByteArray()


       
        // first we'll test the null EthernetAddress
        EthernetAddress ethernet_address = new EthernetAddress(0L);
        assertEquals("Expected length of returned array wrong",
            ETHERNET_ADDRESS_ARRAY_LENGTH,
            ethernet_address.toByteArray().length);
        assertEthernetAddressArraysAreEqual(
            NULL_ETHERNET_ADDRESS_BYTE_ARRAY, 0,
            ethernet_address.toByteArray(), 0);
       
        // now test a non-null EthernetAddress
View Full Code Here


        assertEquals("Expected length of returned array wrong",
            ETHERNET_ADDRESS_ARRAY_LENGTH,
            ethernet_address.toByteArray().length);
        assertEthernetAddressArraysAreEqual(
            NULL_ETHERNET_ADDRESS_BYTE_ARRAY, 0,
            ethernet_address.toByteArray(), 0);
       
        // now test a non-null EthernetAddress
        ethernet_address = new EthernetAddress(VALID_ETHERNET_ADDRESS_LONG);
        assertEquals("Expected length of returned array wrong",
            ETHERNET_ADDRESS_ARRAY_LENGTH,
View Full Code Here

       
        // now test a non-null EthernetAddress
        ethernet_address = new EthernetAddress(VALID_ETHERNET_ADDRESS_LONG);
        assertEquals("Expected length of returned array wrong",
            ETHERNET_ADDRESS_ARRAY_LENGTH,
            ethernet_address.toByteArray().length);
        assertEthernetAddressArraysAreEqual(
            VALID_ETHERNET_ADDRESS_BYTE_ARRAY, 0,
            ethernet_address.toByteArray(), 0);
       
        // let's make sure that changing the returned array doesn't mess with
View Full Code Here

        assertEquals("Expected length of returned array wrong",
            ETHERNET_ADDRESS_ARRAY_LENGTH,
            ethernet_address.toByteArray().length);
        assertEthernetAddressArraysAreEqual(
            VALID_ETHERNET_ADDRESS_BYTE_ARRAY, 0,
            ethernet_address.toByteArray(), 0);
       
        // let's make sure that changing the returned array doesn't mess with
        // the wrapped EthernetAddress's internals
        byte[] ethernet_address_byte_array = ethernet_address.toByteArray();
        // we'll just stir it up a bit and then check that the original
View Full Code Here

            VALID_ETHERNET_ADDRESS_BYTE_ARRAY, 0,
            ethernet_address.toByteArray(), 0);
       
        // let's make sure that changing the returned array doesn't mess with
        // the wrapped EthernetAddress's internals
        byte[] ethernet_address_byte_array = ethernet_address.toByteArray();
        // we'll just stir it up a bit and then check that the original
        // EthernetAddress was not changed in the process.
        // The easiest stir is to sort it ;)
        Arrays.sort(ethernet_address_byte_array);
        assertEthernetAddressArraysAreNotEqual(
View Full Code Here

        Arrays.sort(ethernet_address_byte_array);
        assertEthernetAddressArraysAreNotEqual(
            VALID_ETHERNET_ADDRESS_BYTE_ARRAY, 0,
            ethernet_address_byte_array, 0);
        assertEthernetAddressArraysAreNotEqual(
            ethernet_address.toByteArray(), 0,
            ethernet_address_byte_array, 0);
        assertEthernetAddressArraysAreEqual(
            VALID_ETHERNET_ADDRESS_BYTE_ARRAY, 0,
            ethernet_address.toByteArray(), 0);
    }
View Full Code Here

        assertEthernetAddressArraysAreNotEqual(
            ethernet_address.toByteArray(), 0,
            ethernet_address_byte_array, 0);
        assertEthernetAddressArraysAreEqual(
            VALID_ETHERNET_ADDRESS_BYTE_ARRAY, 0,
            ethernet_address.toByteArray(), 0);
    }
   
    /**
     * Test of toByteArray(byte[]) method,
     * of class com.fasterxml.uuid.EthernetAddress.
View Full Code Here

        // lets test some error cases
        // first, passing null
        try
        {
            EthernetAddress ethernet_address = new EthernetAddress(0L);
            ethernet_address.toByteArray((byte[])null);
            // if we reached here we failed because we didn't get an exception
            fail("Expected exception not caught");
        }
        catch (NullPointerException ex)
        {
View Full Code Here

        // now an array that is too small
        try {
            EthernetAddress ethernet_address = new EthernetAddress(0L);
            byte[] ethernet_address_byte_array =
                new byte[ETHERNET_ADDRESS_ARRAY_LENGTH - 1];
            ethernet_address.toByteArray(ethernet_address_byte_array);
            // if we reached here we failed because we didn't get an exception
            fail("Expected exception not caught");
        } catch (IllegalArgumentException ex) {
            // this is the success case so do nothing
        } catch (Exception ex) {
View Full Code Here

       
        // here we'll test the null EthernetAddress
        EthernetAddress ethernet_address = new EthernetAddress(0L);
        byte[] test_array = new byte[ETHERNET_ADDRESS_ARRAY_LENGTH];
        Arrays.fill(test_array, (byte)'x');
        ethernet_address.toByteArray(test_array);
        assertEthernetAddressArraysAreEqual(
            NULL_ETHERNET_ADDRESS_BYTE_ARRAY, 0, test_array, 0);
       
        // now test a non-null EthernetAddress
        ethernet_address = new EthernetAddress(MIXED_CASE_VALID_ETHERNET_ADDRESS_STRING);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.