Ejemplo n.º 1
0
 @Ignore("not quite ready yet")
 @Test
 public void checkDisposeMethod() {
   NceConsist c = new NceConsist(3, memo);
   // send a reply the memory read instruction trigged by the constructor above.
   nnis.sendTestReply(new NceReply(nnis, "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"), null);
   // verify that c has been added to the traffic controller's
   // list of listeners.
   int listeners = nnis.numListeners();
   c.dispose();
   Assert.assertEquals("dispose check", listeners - 1, nnis.numListeners());
 }
Ejemplo n.º 2
0
 @Test
 public void testGetConsistType() {
   NceConsist c = new NceConsist(3, memo);
   // send a reply the memory read instruction trigged by the constructor above.
   nnis.sendTestReply(new NceReply(nnis, "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"), null);
   Assert.assertEquals("default consist type", jmri.Consist.ADVANCED_CONSIST, c.getConsistType());
   c.dispose();
 }
Ejemplo n.º 3
0
 @Test
 public void testCtor() {
   NceConsist m = new NceConsist(3, memo);
   // send a reply the memory read instruction trigged by the constructor above.
   nnis.sendTestReply(new NceReply(nnis, "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"), null);
   Assert.assertNotNull(m);
   m.dispose();
 }
Ejemplo n.º 4
0
 @Test
 public void checkGetLocoDirectionAdvanced() {
   NceConsist c = new NceConsist(3, memo);
   // send a reply the memory read instruction trigged by the constructor above.
   nnis.sendTestReply(new NceReply(nnis, "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"), null);
   c.setConsistType(jmri.Consist.ADVANCED_CONSIST);
   jmri.DccLocoAddress A = new jmri.DccLocoAddress(200, true);
   jmri.DccLocoAddress B = new jmri.DccLocoAddress(250, true);
   c.restore(A, true); // use restore here, as it does not send
   // any data to the command station
   nnis.sendTestReply(new NceReply(nnis, "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"), null);
   c.restore(B, false); // revese direction.
   nnis.sendTestReply(new NceReply(nnis, "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"), null);
   Assert.assertTrue("Direction in Advanced Consist", c.getLocoDirection(A));
   Assert.assertFalse("Direction in Advanced Consist", c.getLocoDirection(B));
   c.dispose();
 }
Ejemplo n.º 5
0
 @Test
 public void checkAddressAllowedGoodAdvanced() {
   NceConsist c = new NceConsist(3, memo);
   // send a reply the memory read instruction trigged by the constructor above.
   nnis.sendTestReply(new NceReply(nnis, "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"), null);
   c.setConsistType(jmri.Consist.ADVANCED_CONSIST);
   Assert.assertTrue("AddressAllowed", c.isAddressAllowed(new jmri.DccLocoAddress(200, true)));
   c.dispose();
 }
Ejemplo n.º 6
0
 @Test
 public void testSetConsistTypeCS() {
   NceConsist c = new NceConsist(3, memo);
   // send a reply the memory read instruction trigged by the constructor above.
   nnis.sendTestReply(new NceReply(nnis, "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"), null);
   c.setConsistType(jmri.Consist.CS_CONSIST);
   jmri.util.JUnitAppender.assertErrorMessage("Consist Type Not Supported");
   c.dispose();
 }
Ejemplo n.º 7
0
 @Test
 public void testCtor2() {
   // DccLocoAddress constructor test.
   NceConsist c = new NceConsist(new DccLocoAddress(3, false), memo);
   // send a reply the memory read instruction trigged by the constructor above.
   nnis.sendTestReply(new NceReply(nnis, "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"), null);
   Assert.assertNotNull(c);
   c.dispose();
 }
Ejemplo n.º 8
0
 @Test
 public void checkSizeLimitAdvanced() {
   NceConsist c = new NceConsist(3, memo);
   // send a reply the memory read instruction trigged by the constructor above.
   nnis.sendTestReply(new NceReply(nnis, "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"), null);
   c.setConsistType(jmri.Consist.ADVANCED_CONSIST);
   Assert.assertEquals("Advanced Consist Limit", 6, c.sizeLimit());
   c.dispose();
 }
Ejemplo n.º 9
0
 @Test
 public void testSetConsistTypeOther() {
   NceConsist c = new NceConsist(3, memo);
   // send a reply the memory read instruction trigged by the constructor above.
   nnis.sendTestReply(new NceReply(nnis, "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"), null);
   c.setConsistType(255);
   // make sure an error message is generated.
   jmri.util.JUnitAppender.assertErrorMessage("Consist Type Not Supported");
   c.dispose();
 }
Ejemplo n.º 10
0
 @Test
 public void checkContainsAdvanced() {
   NceConsist c = new NceConsist(3, memo);
   // send a reply the memory read instruction trigged by the constructor above.
   nnis.sendTestReply(new NceReply(nnis, "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"), null);
   c.setConsistType(jmri.Consist.ADVANCED_CONSIST);
   jmri.DccLocoAddress A = new jmri.DccLocoAddress(200, true);
   jmri.DccLocoAddress B = new jmri.DccLocoAddress(250, true);
   // nothing added, should be false for all.
   Assert.assertFalse("Advanced Consist Contains", c.contains(A));
   Assert.assertFalse("Advanced Consist Contains", c.contains(B));
   // add just A
   c.restore(A, true); // use restore here, as it does not send
   // any data to the command station
   nnis.sendTestReply(new NceReply(nnis, "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"), null);
   Assert.assertTrue("Advanced Consist Contains", c.contains(A));
   Assert.assertFalse("Advanced Consist Contains", c.contains(B));
   // then add B
   c.restore(B, false);
   nnis.sendTestReply(new NceReply(nnis, "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"), null);
   Assert.assertTrue("Advanced Consist Contains", c.contains(A));
   Assert.assertTrue("Advanced Consist Contains", c.contains(B));
   c.dispose();
 }