Пример #1
0
  @Test
  public void testDate() {
    MVELDateCoercion co = new MVELDateCoercion();
    assertTrue(co.canConvertFrom(Date.class));
    assertFalse(co.canConvertFrom(Number.class));

    Date d = new Date();
    assertSame(d, co.convertFrom(d));
  }
Пример #2
0
  @Test
  public void testString() throws Exception {
    MVELDateCoercion co = new MVELDateCoercion();
    assertTrue(co.canConvertFrom(Date.class));
    SimpleDateFormat df = new SimpleDateFormat("dd-MMM-yyyy", Locale.UK);

    String dt = df.format(df.parse("10-Jul-1974"));
    Date dt_ = DateUtils.parseDate(dt, new DateFormatsImpl());
    assertEquals(dt_, co.convertFrom(dt));
  }