use of jmri.jmrix.lenz.XNetMessage in project JMRI by JMRI.
the class XNetSimulatorAdapterTest method testEmergencyStopLocoReplyV1V2.
@Test
public void testEmergencyStopLocoReplyV1V2() {
XNetSimulatorAdapter a = new XNetSimulatorAdapter();
// NOTE: this test uses reflection to test a private method.
java.lang.reflect.Method generateReplyMethod = null;
try {
generateReplyMethod = a.getClass().getDeclaredMethod("generateReply", XNetMessage.class);
} catch (java.lang.NoSuchMethodException nsm) {
Assert.fail("Could not find method generateReply in XNetSimulatorAdapter class: ");
}
// override the default permissions.
Assert.assertNotNull(generateReplyMethod);
generateReplyMethod.setAccessible(true);
try {
XNetReply r = (XNetReply) generateReplyMethod.invoke(a, new XNetMessage("91 02 93"));
Assert.assertEquals("CS Emergency Specific Loco (XNetV1,V2) Reply ", new XNetReply("01 04 05"), r);
} catch (java.lang.IllegalAccessException ite) {
Assert.fail("could not access method generateReply in XNetSimulatoradapter class");
} catch (java.lang.reflect.InvocationTargetException ite) {
Throwable cause = ite.getCause();
Assert.fail("generateReply execution failed reason: " + cause.getMessage());
}
}
use of jmri.jmrix.lenz.XNetMessage in project JMRI by JMRI.
the class XNetSimulatorAdapterTest method testEmergencyStopAllReply.
@Test
public void testEmergencyStopAllReply() {
XNetSimulatorAdapter a = new XNetSimulatorAdapter();
// NOTE: this test uses reflection to test a private method.
java.lang.reflect.Method generateReplyMethod = null;
try {
generateReplyMethod = a.getClass().getDeclaredMethod("generateReply", XNetMessage.class);
} catch (java.lang.NoSuchMethodException nsm) {
Assert.fail("Could not find method generateReply in XNetSimulatorAdapter class: ");
}
// override the default permissions.
Assert.assertNotNull(generateReplyMethod);
generateReplyMethod.setAccessible(true);
try {
XNetReply r = (XNetReply) generateReplyMethod.invoke(a, new XNetMessage("80 80"));
Assert.assertEquals("CS Emergency Stop All Reply ", new XNetReply("81 00 81"), r);
} catch (java.lang.IllegalAccessException ite) {
Assert.fail("could not access method generateReply in XNetSimulatoradapter class");
} catch (java.lang.reflect.InvocationTargetException ite) {
Throwable cause = ite.getCause();
Assert.fail("generateReply execution failed reason: " + cause.getMessage());
}
}
use of jmri.jmrix.lenz.XNetMessage in project JMRI by JMRI.
the class Z21XNetSimulatorAdapterTest method testGenerateResumeOperationsReply.
@Test
public void testGenerateResumeOperationsReply() {
Z21XNetSimulatorAdapter a = new Z21XNetSimulatorAdapter();
Assert.assertEquals("CS Resume Operations Reply", new XNetReply("61 82 E3"), a.generateReply(new XNetMessage("21 81 A0")));
}
use of jmri.jmrix.lenz.XNetMessage in project JMRI by JMRI.
the class Z21XNetSimulatorAdapterTest method testGenerateEmergencyStopReply.
@Test
public void testGenerateEmergencyStopReply() {
Z21XNetSimulatorAdapter a = new Z21XNetSimulatorAdapter();
Assert.assertEquals("CS Emergency Stop Reply", new XNetReply("61 82 E3"), a.generateReply(new XNetMessage("21 80 A1")));
}
use of jmri.jmrix.lenz.XNetMessage in project JMRI by JMRI.
the class Z21XNetSimulatorAdapterTest method testGenerateEmergencyStopLocoReply.
@Test
public void testGenerateEmergencyStopLocoReply() {
Z21XNetSimulatorAdapter a = new Z21XNetSimulatorAdapter();
Assert.assertEquals("CS Emergeny Stop Specific Loco (XNetV4)", new XNetReply("01 04 05"), a.generateReply(new XNetMessage("92 00 02 90")));
}
Aggregations