Search in sources :

Example 6 with Turnout

use of jmri.Turnout in project JMRI by JMRI.

the class QuadOutputSignalHeadTest method testCTor.

@Test
public void testCTor() {
    Turnout it = (InstanceManager.getDefault(TurnoutManager.class)).provideTurnout("IT1");
    NamedBeanHandle<Turnout> green = new NamedBeanHandle<>("green handle", it);
    Turnout it2 = (InstanceManager.getDefault(TurnoutManager.class)).provideTurnout("IT3");
    NamedBeanHandle<Turnout> red = new NamedBeanHandle<>("red handle", it2);
    Turnout it3 = (InstanceManager.getDefault(TurnoutManager.class)).provideTurnout("IT2");
    NamedBeanHandle<Turnout> yellow = new NamedBeanHandle<>("yellow handle", it3);
    Turnout it4 = (InstanceManager.getDefault(TurnoutManager.class)).provideTurnout("IT4");
    NamedBeanHandle<Turnout> lunar = new NamedBeanHandle<>("lunar handle", it4);
    QuadOutputSignalHead t = new QuadOutputSignalHead("Test Head", green, red, yellow, lunar);
    Assert.assertNotNull("exists", t);
}
Also used : Turnout(jmri.Turnout) NamedBeanHandle(jmri.NamedBeanHandle) Test(org.junit.Test)

Example 7 with Turnout

use of jmri.Turnout in project JMRI by JMRI.

the class RawTurnoutOperatorTest method testCTor.

@Test
public void testCTor() {
    Turnout it = (InstanceManager.getDefault(TurnoutManager.class)).provideTurnout("IT1");
    RawTurnoutOperator t = new RawTurnoutOperator((AbstractTurnout) it, 5, 5);
    jmri.util.JUnitAppender.assertErrorMessage("No match against the command station for IT1, so will use the default");
    Assert.assertNotNull("exists", t);
}
Also used : Turnout(jmri.Turnout) Test(org.junit.Test)

Example 8 with Turnout

use of jmri.Turnout in project JMRI by JMRI.

the class SensorTurnoutOperatorTest method testCTor.

@Test
public void testCTor() {
    Turnout it = (InstanceManager.getDefault(TurnoutManager.class)).provideTurnout("IT1");
    SensorTurnoutOperator t = new SensorTurnoutOperator((AbstractTurnout) it, 5, 5);
    Assert.assertNotNull("exists", t);
}
Also used : Turnout(jmri.Turnout) Test(org.junit.Test)

Example 9 with Turnout

use of jmri.Turnout in project JMRI by JMRI.

the class SE8cSignalHeadTest method testStateFollowingCtor1.

@Test
public void testStateFollowingCtor1() {
    Turnout it11 = InstanceManager.turnoutManagerInstance().provideTurnout("11");
    Turnout it12 = InstanceManager.turnoutManagerInstance().provideTurnout("12");
    SE8cSignalHead s1 = new SE8cSignalHead(new NamedBeanHandle<Turnout>("11", it11), new NamedBeanHandle<Turnout>("12", it12), "user name");
    // s2 should follow s1
    SE8cSignalHead s2 = new SE8cSignalHead(new NamedBeanHandle<Turnout>("11", it11), new NamedBeanHandle<Turnout>("12", it12));
    s1.setAppearance(SignalHead.DARK);
    Assert.assertEquals("s2 after DARK", SignalHead.DARK, s2.getAppearance());
    s1.setAppearance(SignalHead.RED);
    Assert.assertEquals("s2 after RED", SignalHead.RED, s2.getAppearance());
    s1.setAppearance(SignalHead.GREEN);
    Assert.assertEquals("s2 after GREEN", SignalHead.GREEN, s2.getAppearance());
    s1.setAppearance(SignalHead.YELLOW);
    Assert.assertEquals("s2 after YELLOW", SignalHead.YELLOW, s2.getAppearance());
    s1.setAppearance(SignalHead.DARK);
    Assert.assertEquals("s2 after DARK", SignalHead.DARK, s2.getAppearance());
}
Also used : Turnout(jmri.Turnout) Test(org.junit.Test)

Example 10 with Turnout

use of jmri.Turnout in project JMRI by JMRI.

the class SE8cSignalHeadTest method testRedState.

@Test
public void testRedState() {
    Turnout it11 = InstanceManager.turnoutManagerInstance().provideTurnout("11");
    Turnout it12 = InstanceManager.turnoutManagerInstance().provideTurnout("12");
    SE8cSignalHead s = new SE8cSignalHead(new NamedBeanHandle<Turnout>("11", it11), new NamedBeanHandle<Turnout>("12", it12), "user name");
    s.setAppearance(SignalHead.RED);
    Assert.assertEquals("to low after", Turnout.THROWN, it11.getCommandedState());
    Assert.assertEquals("to high after", Turnout.CLOSED, it12.getCommandedState());
}
Also used : Turnout(jmri.Turnout) Test(org.junit.Test)

Aggregations

Turnout (jmri.Turnout)221 Test (org.junit.Test)63 Sensor (jmri.Sensor)26 SignalHead (jmri.SignalHead)20 Element (org.jdom2.Element)20 TurnoutManager (jmri.TurnoutManager)17 JmriException (jmri.JmriException)11 Light (jmri.Light)10 SignalMast (jmri.SignalMast)10 ActionEvent (java.awt.event.ActionEvent)9 NamedBeanHandle (jmri.NamedBeanHandle)9 JsonException (jmri.server.json.JsonException)9 ActionListener (java.awt.event.ActionListener)8 Block (jmri.Block)7 JsonNode (com.fasterxml.jackson.databind.JsonNode)6 NamedBean (jmri.NamedBean)6 Route (jmri.Route)6 AbstractTurnout (jmri.implementation.AbstractTurnout)6 IOException (java.io.IOException)5 ArrayList (java.util.ArrayList)5