use of com.digi.xbee.api.RemoteXBeeDevice in project JMRI by JMRI.
the class XBeeNodeTest method testGetPreferedNameAsGlobalAddress.
@Test
public void testGetPreferedNameAsGlobalAddress() {
// Mock the remote device.
RemoteXBeeDevice rd = Mockito.mock(RemoteXBeeDevice.class);
Mockito.when(rd.getXBeeProtocol()).thenReturn(XBeeProtocol.UNKNOWN);
Mockito.when(rd.getNodeID()).thenReturn("");
Mockito.when(rd.get64BitAddress()).thenReturn(new XBee64BitAddress("0013A20040A04D2D"));
Mockito.when(rd.get16BitAddress()).thenReturn(new XBee16BitAddress("FFFE"));
byte[] pan = { (byte) 0x00, (byte) 0x42 };
byte[] uad = { (byte) 0xFF, (byte) 0xFE };
byte[] gad = { (byte) 0x00, (byte) 0x13, (byte) 0xA2, (byte) 0x00, (byte) 0x40, (byte) 0xA0, (byte) 0x4D, (byte) 0x2D };
XBeeNode node = new XBeeNode(pan, uad, gad);
tc.registerNode(node);
node.setXBee(rd);
Assert.assertEquals("Global Address Name", "00 13 A2 00 40 A0 4D 2D ", node.getPreferedName());
}
Aggregations