Skip to content
Permalink
Browse files

improve tests

  • Loading branch information...
bobjacobsen committed Sep 23, 2018
1 parent e814d4f commit 0bea01970c3540f9dc64761d3c88e8d7df9b14da
Showing with 23 additions and 0 deletions.
  1. +23 −0 java/test/jmri/jmrit/simpleclock/SimpleTimebaseTest.java
@@ -40,6 +40,11 @@ public void testNoDelay() {
p.dispose();
}

public void testGetBeanType() {
SimpleTimebase p = new SimpleTimebase();
Assert.assertEquals("Time", p.getBeanType());
}

public void testSetStartTime() {
SimpleTimebase p = new SimpleTimebase();
p.setRun(false); // prevent clock ticking during test
@@ -66,11 +71,17 @@ public void testSetStartTime() {
public void testSetTimeDate() {
SimpleTimebase p = new SimpleTimebase();
p.setRun(false); // prevent clock ticking during test
Assert.assertFalse(p.getRun());

Date now = new Date();

p.setTime(now);
Assert.assertFalse(p.getRun()); // still
Assert.assertEquals("Time Set",now.toString(),p.getTime().toString());

p.setRun(true);
Assert.assertTrue(p.getRun());

p.dispose();
}

@@ -86,6 +97,18 @@ public void testSetTimeInstant() {
p.dispose();
}

public void testSetGetRate() {
SimpleTimebase p = new SimpleTimebase();
p.setRun(false); // prevent clock ticking during test

Assert.assertEquals(1.0, p.getRate(), 0.01);

p.setRate(2.0);
Assert.assertEquals(2.0, p.getRate(), 0.01);
Assert.assertFalse(p.getRun()); // still

}

/* public void testShortDelay() { */
/* SimpleTimebase p = new SimpleTimebase(); */
/* Date now = new Date(); */

0 comments on commit 0bea019

Please sign in to comment.
You can’t perform that action at this time.