Merge pull request #72 from Parabot/development

[TASK] Added unit test for mac address
This commit is contained in:
Jeroen Ketelaar
2016-05-20 00:34:37 +02:00
2 changed files with 39 additions and 0 deletions
+5
View File
@@ -72,6 +72,11 @@
<artifactId>bugsnag</artifactId>
<version>1.2.8</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
</dependencies>
<build>
@@ -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);
}
}