MacAddressUtilTest Class — netty Architecture
Architecture documentation for the MacAddressUtilTest class in MacAddressUtilTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 1b384915_b7eb_7a58_649b_38b1444221ff["MacAddressUtilTest"] 2541cd83_88a0_3273_d1cf_b2a4f7011333["MacAddressUtilTest.java"] 1b384915_b7eb_7a58_649b_38b1444221ff -->|defined in| 2541cd83_88a0_3273_d1cf_b2a4f7011333 47f7c295_60c7_1a2f_e33b_86f34898092e["testCompareAddresses()"] 1b384915_b7eb_7a58_649b_38b1444221ff -->|method| 47f7c295_60c7_1a2f_e33b_86f34898092e 0040bc2d_994d_4f32_84eb_1f0422d7af78["testParseMacEUI48()"] 1b384915_b7eb_7a58_649b_38b1444221ff -->|method| 0040bc2d_994d_4f32_84eb_1f0422d7af78 5a8b42f8_351e_ab94_799d_3e783426c3ae["testParseMacMAC48ToEUI64()"] 1b384915_b7eb_7a58_649b_38b1444221ff -->|method| 5a8b42f8_351e_ab94_799d_3e783426c3ae d5ff417d_2391_6c8b_68cc_915634d72f14["testParseMacEUI48ToEUI64()"] 1b384915_b7eb_7a58_649b_38b1444221ff -->|method| d5ff417d_2391_6c8b_68cc_915634d72f14 a1cce836_14ed_6adb_bd7b_ac8e04f19a3e["testParseMacInvalid7HexGroupsA()"] 1b384915_b7eb_7a58_649b_38b1444221ff -->|method| a1cce836_14ed_6adb_bd7b_ac8e04f19a3e 1b006673_32bb_4e32_09c9_aef99d8cf5e9["testParseMacInvalid7HexGroupsB()"] 1b384915_b7eb_7a58_649b_38b1444221ff -->|method| 1b006673_32bb_4e32_09c9_aef99d8cf5e9 8a0b8d40_3db7_2219_253d_1c27c715232e["testParseMacInvalidEUI48MixedSeparatorA()"] 1b384915_b7eb_7a58_649b_38b1444221ff -->|method| 8a0b8d40_3db7_2219_253d_1c27c715232e b8eedafe_855b_ee8f_6bef_dae205b73d5c["testParseMacInvalidEUI48MixedSeparatorB()"] 1b384915_b7eb_7a58_649b_38b1444221ff -->|method| b8eedafe_855b_ee8f_6bef_dae205b73d5c dacf1853_7116_2f6e_ce3e_a36eac9f3694["testParseMacInvalidEUI64MixedSeparatorA()"] 1b384915_b7eb_7a58_649b_38b1444221ff -->|method| dacf1853_7116_2f6e_ce3e_a36eac9f3694 25c9b477_703b_e108_2678_33f505f07353["testParseMacInvalidEUI64MixedSeparatorB()"] 1b384915_b7eb_7a58_649b_38b1444221ff -->|method| 25c9b477_703b_e108_2678_33f505f07353 998d7bcf_4e6d_827e_4fc7_fe79d92e0090["testParseMacInvalidEUI48TrailingSeparatorA()"] 1b384915_b7eb_7a58_649b_38b1444221ff -->|method| 998d7bcf_4e6d_827e_4fc7_fe79d92e0090 03b949da_7176_e4fc_3fee_35e1d6f16909["testParseMacInvalidEUI48TrailingSeparatorB()"] 1b384915_b7eb_7a58_649b_38b1444221ff -->|method| 03b949da_7176_e4fc_3fee_35e1d6f16909 c6bba526_fb5e_8c82_10fc_f01ff801b2b4["testParseMacInvalidEUI64TrailingSeparatorA()"] 1b384915_b7eb_7a58_649b_38b1444221ff -->|method| c6bba526_fb5e_8c82_10fc_f01ff801b2b4
Relationship Graph
Source Code
common/src/test/java/io/netty/util/internal/MacAddressUtilTest.java lines 27–198
public class MacAddressUtilTest {
@Test
public void testCompareAddresses() {
// should not prefer empty address when candidate is not globally unique
assertEquals(
0,
MacAddressUtil.compareAddresses(
EMPTY_BYTES,
new byte[]{(byte) 0x52, (byte) 0x54, (byte) 0x00, (byte) 0xf9, (byte) 0x32, (byte) 0xbd}));
// only candidate is globally unique
assertEquals(
-1,
MacAddressUtil.compareAddresses(
EMPTY_BYTES,
new byte[]{(byte) 0x50, (byte) 0x54, (byte) 0x00, (byte) 0xf9, (byte) 0x32, (byte) 0xbd}));
// only candidate is globally unique
assertEquals(
-1,
MacAddressUtil.compareAddresses(
new byte[]{(byte) 0x52, (byte) 0x54, (byte) 0x00, (byte) 0xf9, (byte) 0x32, (byte) 0xbd},
new byte[]{(byte) 0x50, (byte) 0x54, (byte) 0x00, (byte) 0xf9, (byte) 0x32, (byte) 0xbd}));
// only current is globally unique
assertEquals(
1,
MacAddressUtil.compareAddresses(
new byte[]{(byte) 0x52, (byte) 0x54, (byte) 0x00, (byte) 0xf9, (byte) 0x32, (byte) 0xbd},
EMPTY_BYTES));
// only current is globally unique
assertEquals(
1,
MacAddressUtil.compareAddresses(
new byte[]{(byte) 0x50, (byte) 0x54, (byte) 0x00, (byte) 0xf9, (byte) 0x32, (byte) 0xbd},
new byte[]{(byte) 0x52, (byte) 0x54, (byte) 0x00, (byte) 0xf9, (byte) 0x32, (byte) 0xbd}));
// both are globally unique
assertEquals(
0,
MacAddressUtil.compareAddresses(
new byte[]{(byte) 0x50, (byte) 0x54, (byte) 0x00, (byte) 0xf9, (byte) 0x32, (byte) 0xbd},
new byte[]{(byte) 0x50, (byte) 0x55, (byte) 0x01, (byte) 0xfa, (byte) 0x33, (byte) 0xbe}));
}
@Test
public void testParseMacEUI48() {
assertArrayEquals(new byte[]{0, (byte) 0xaa, 0x11, (byte) 0xbb, 0x22, (byte) 0xcc},
parseMAC("00-AA-11-BB-22-CC"));
assertArrayEquals(new byte[]{0, (byte) 0xaa, 0x11, (byte) 0xbb, 0x22, (byte) 0xcc},
parseMAC("00:AA:11:BB:22:CC"));
}
@Test
public void testParseMacMAC48ToEUI64() {
// MAC-48 into an EUI-64
assertArrayEquals(new byte[]{0, (byte) 0xaa, 0x11, (byte) 0xff, (byte) 0xff, (byte) 0xbb, 0x22, (byte) 0xcc},
parseMAC("00-AA-11-FF-FF-BB-22-CC"));
assertArrayEquals(new byte[]{0, (byte) 0xaa, 0x11, (byte) 0xff, (byte) 0xff, (byte) 0xbb, 0x22, (byte) 0xcc},
parseMAC("00:AA:11:FF:FF:BB:22:CC"));
}
@Test
public void testParseMacEUI48ToEUI64() {
// EUI-48 into an EUI-64
assertArrayEquals(new byte[]{0, (byte) 0xaa, 0x11, (byte) 0xff, (byte) 0xfe, (byte) 0xbb, 0x22, (byte) 0xcc},
parseMAC("00-AA-11-FF-FE-BB-22-CC"));
assertArrayEquals(new byte[]{0, (byte) 0xaa, 0x11, (byte) 0xff, (byte) 0xfe, (byte) 0xbb, 0x22, (byte) 0xcc},
parseMAC("00:AA:11:FF:FE:BB:22:CC"));
}
@Test
public void testParseMacInvalid7HexGroupsA() {
assertThrows(IllegalArgumentException.class, new Executable() {
@Override
public void execute() {
parseMAC("00-AA-11-BB-22-CC-FF");
}
});
}
Source
Frequently Asked Questions
What is the MacAddressUtilTest class?
MacAddressUtilTest is a class in the netty codebase, defined in common/src/test/java/io/netty/util/internal/MacAddressUtilTest.java.
Where is MacAddressUtilTest defined?
MacAddressUtilTest is defined in common/src/test/java/io/netty/util/internal/MacAddressUtilTest.java at line 27.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free