use of jmri.Turnout in project JMRI by JMRI.
the class ProxyTurnoutManagerTest method testDefaultSystemName.
public void testDefaultSystemName() {
// create
Turnout t = l.provideTurnout("" + getNumToTest1());
// check
Assert.assertTrue("real object returned ", t != null);
Assert.assertTrue("system name correct ", t == l.getBySystemName(getSystemName(getNumToTest1())));
}
use of jmri.Turnout in project JMRI by JMRI.
the class ProxyTurnoutManagerTest method testProvideUser.
public void testProvideUser() {
Turnout l1 = l.provideTurnout("211");
l1.setUserName("user 1");
Turnout l2 = l.provideTurnout("user 1");
Turnout l3 = l.getTurnout("user 1");
Assert.assertNotNull(l1);
Assert.assertNotNull(l2);
Assert.assertNotNull(l3);
Assert.assertEquals(l1, l2);
Assert.assertEquals(l3, l2);
Assert.assertEquals(l1, l3);
Turnout l4 = l.getTurnout("JLuser 1");
Assert.assertNull(l4);
}
use of jmri.Turnout in project JMRI by JMRI.
the class ProxyTurnoutManagerTest method testProvideFailure.
public void testProvideFailure() {
boolean correct = false;
try {
Turnout t = l.provideTurnout("");
Assert.fail("didn't throw");
} catch (IllegalArgumentException ex) {
correct = true;
}
Assert.assertTrue("Exception thrown properly", correct);
jmri.util.JUnitAppender.assertErrorMessage("Invalid system name for turnout: JT needed JT");
}
use of jmri.Turnout in project JMRI by JMRI.
the class ProxyTurnoutManagerTest method testRename.
public void testRename() {
// get
Turnout t1 = l.newTurnout(getSystemName(getNumToTest1()), "before");
Assert.assertNotNull("t1 real object ", t1);
t1.setUserName("after");
Turnout t2 = l.getByUserName("after");
Assert.assertEquals("same object", t1, t2);
Assert.assertEquals("no old object", null, l.getByUserName("before"));
}
use of jmri.Turnout in project JMRI by JMRI.
the class ProxyTurnoutManagerTest method testUpperLower.
public void testUpperLower() {
Turnout t = l.provideTurnout("" + getNumToTest2());
String name = t.getSystemName();
Assert.assertNull(l.getTurnout(name.toLowerCase()));
}
Aggregations