Exemplo n.º 1
0
 @Test(expectedExceptions = InvalidChronogramException.class)
 public void chronoref_ref_to_null()
     throws InvalidChrononogramExpressionException, InvalidNPMLConfigurationException,
         InvalidChronogramException {
   ChronogramSimple b = null;
   ChronogramReference cr = new ChronogramReference("Chrono 1");
   cr.setReferencedElement(b);
 }
Exemplo n.º 2
0
 @Test
 public void chronoref_ref_simple_named()
     throws InvalidChrononogramExpressionException, InvalidNPMLConfigurationException,
         InvalidChronogramException {
   ChronogramSimple simple = new ChronogramSimple("Mon-Fri");
   simple.setClock(new Clock());
   simple.setName("Simple");
   ChronogramReference c = new ChronogramReference(simple.getName());
   c.setReferencedElement(simple);
   assertEquals(c.getReferencedElement(), simple);
   assertEquals(c.getReferencedChronogramName(), simple.getName());
 }
Exemplo n.º 3
0
 @Test
 public void chronoref_ref_evaluates_to_false()
     throws InvalidChrononogramExpressionException, InvalidNPMLConfigurationException,
         InvalidChronogramException {
   DateTime dt = new DateTime().withHourOfDay(12);
   ChronogramSimple simple = new ChronogramSimple("13-11");
   simple.setClock(new Clock());
   simple.getClock().setNow(dt);
   simple.setName("Simple");
   ChronogramReference c1 = new ChronogramReference(simple.getName());
   c1.setReferencedElement(simple);
   assertFalse(c1.isTrue());
 }
Exemplo n.º 4
0
 @Test
 public void chronoref_xml()
     throws InvalidChrononogramExpressionException, InvalidNPMLConfigurationException,
         InvalidChronogramException {
   DateTime dt = new DateTime().withHourOfDay(12);
   ChronogramSimple simple = new ChronogramSimple("13-11");
   simple.setClock(new Clock());
   simple.getClock().setNow(dt);
   simple.setName("Simple");
   ChronogramReference c1 = new ChronogramReference(simple.getName());
   c1.setReferencedElement(simple);
   assertFalse(c1.isTrue());
   //  Check xml.
   assertEquals(_serialize.outputString(c1.xml()), "<chronogram_ref ref=\"Simple\" />");
 }