mirror of
https://github.com/2006-Scape/Parabot.git
synced 2026-07-03 08:39:09 +00:00
Merge pull request #72 from Parabot/development
[TASK] Added unit test for mac address
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package org.parabot;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.parabot.core.network.NetworkInterface;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @author JKetelaar
|
||||
*/
|
||||
public class MacAddressUnitTest {
|
||||
|
||||
@Test
|
||||
public void test(){
|
||||
String[] macString = new String[]{
|
||||
"19",
|
||||
"5C",
|
||||
"11",
|
||||
"19",
|
||||
"5C",
|
||||
"11"
|
||||
};
|
||||
NetworkInterface networkInterface = new NetworkInterface();
|
||||
|
||||
byte[] mac = new byte[6];
|
||||
for (int j = 0; j < 6; j++) {
|
||||
mac[j] = Byte.parseByte(macString[j], 16); // parses a hex number
|
||||
}
|
||||
NetworkInterface.setMac(mac);
|
||||
|
||||
Assert.assertArrayEquals(networkInterface.getHardwareAddress(), mac);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user