use of com.enonic.xp.form.Input in project xp by enonic.
the class DateTimeTypeTest method testCreateDefaultValue_invalid.
@Test
public void testCreateDefaultValue_invalid() {
final Input input = getDefaultInputBuilder(InputTypeName.DATE_TIME, "2014-18-16T05:03:45").inputTypeConfig(InputTypeConfig.create().property(InputTypeProperty.create("timezone", "true").build()).build()).build();
assertThrows(IllegalArgumentException.class, () -> this.type.createDefaultValue(input));
}
use of com.enonic.xp.form.Input in project xp by enonic.
the class DateTimeTypeTest method testCreateDefaultValue_withTimezone_format2_minus.
@Test
public void testCreateDefaultValue_withTimezone_format2_minus() {
final Input input = getDefaultInputBuilder(InputTypeName.DATE_TIME, "2014-08-16T10:03:45-03:00").inputTypeConfig(InputTypeConfig.create().property(InputTypeProperty.create("timezone", "true").build()).build()).build();
final Value value = this.type.createDefaultValue(input);
assertNotNull(value);
assertSame(ValueTypes.DATE_TIME, value.getType());
assertEquals(value.toString(), "2014-08-16T13:03:45Z");
}
use of com.enonic.xp.form.Input in project xp by enonic.
the class CheckBoxTypeTest method testCreateDefaultValue.
@Test
public void testCreateDefaultValue() {
final Input input = getDefaultInputBuilder(InputTypeName.CHECK_BOX, "checked").build();
final Value value = this.type.createDefaultValue(input);
assertNotNull(value);
assertEquals("true", value.toString());
}
use of com.enonic.xp.form.Input in project xp by enonic.
the class DateTimeTypeTest method testCreateDefaultValue_withTimezone_format2_day_change.
@Test
public void testCreateDefaultValue_withTimezone_format2_day_change() {
final Input input = getDefaultInputBuilder(InputTypeName.DATE_TIME, "2014-08-16T22:03:45-03:00").inputTypeConfig(InputTypeConfig.create().property(InputTypeProperty.create("timezone", "true").build()).build()).build();
final Value value = this.type.createDefaultValue(input);
assertNotNull(value);
assertSame(ValueTypes.DATE_TIME, value.getType());
assertEquals(value.toString(), "2014-08-17T01:03:45Z");
}
use of com.enonic.xp.form.Input in project xp by enonic.
the class DateTimeTypeTest method testRelativeDefaultValue_only_relative_date_exists.
@Test
public void testRelativeDefaultValue_only_relative_date_exists() {
final Input input = getDefaultInputBuilder(InputTypeName.DATE_TIME, "+1year -5months -36d").build();
final Value value = this.type.createDefaultValue(input);
assertNotNull(value);
assertSame(ValueTypes.LOCAL_DATE_TIME, value.getType());
}
Aggregations