Search in sources :

Example 1 with AbstractTurnout

use of jmri.implementation.AbstractTurnout in project JMRI by JMRI.

the class NamedBeanHandleTest method testHoldsTurnout.

public void testHoldsTurnout() {
    Turnout t = new AbstractTurnout("name") {

        @Override
        protected void forwardCommandChangeToLayout(int s) {
        }

        @Override
        protected void turnoutPushbuttonLockout(boolean b) {
        }
    };
    NamedBeanHandle<Turnout> n = new NamedBeanHandle<Turnout>("name", t);
    Assert.assertEquals("same TO", t, n.getBean());
}
Also used : AbstractTurnout(jmri.implementation.AbstractTurnout) AbstractTurnout(jmri.implementation.AbstractTurnout) Turnout(jmri.Turnout)

Example 2 with AbstractTurnout

use of jmri.implementation.AbstractTurnout in project JMRI by JMRI.

the class OrderedHashtableTest method testPut.

public void testPut() {
    OrderedHashtable<String, Turnout> oht = new OrderedHashtable<String, Turnout>();
    Turnout t1 = new AbstractTurnout("t1") {

        @Override
        protected void forwardCommandChangeToLayout(int s) {
        }

        @Override
        protected void turnoutPushbuttonLockout(boolean locked) {
        }
    };
    Turnout t2 = new TestTurnout("t2");
    Turnout t3 = new TestTurnout("t3");
    // load
    oht.put("1", t1);
    oht.put("2", t2);
    oht.put("3", t3);
    // check order
    Enumeration<String> en = oht.keys();
    String t;
    Assert.assertTrue(en.hasMoreElements());
    t = en.nextElement();
    Assert.assertNotNull(t);
    Assert.assertTrue(t.equals("1"));
    Assert.assertTrue(en.hasMoreElements());
    t = en.nextElement();
    Assert.assertNotNull(t);
    Assert.assertTrue(t.equals("2"));
    Assert.assertTrue(en.hasMoreElements());
    t = en.nextElement();
    Assert.assertNotNull(t);
    Assert.assertTrue(t.equals("3"));
    Assert.assertTrue(!en.hasMoreElements());
}
Also used : AbstractTurnout(jmri.implementation.AbstractTurnout) AbstractTurnout(jmri.implementation.AbstractTurnout) Turnout(jmri.Turnout)

Aggregations

Turnout (jmri.Turnout)2 AbstractTurnout (jmri.implementation.AbstractTurnout)2