use of com.enonic.xp.data.Value in project xp by enonic.
the class DateTimeTypeTest method testRelativeDefaultValue_date_time.
@Test
public void testRelativeDefaultValue_date_time() {
final Input input = getDefaultInputBuilder(InputTypeName.DATE_TIME, "+1year -5months -36d +2minutes -1h").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());
}
use of com.enonic.xp.data.Value in project xp by enonic.
the class DateTimeTypeTest method testRelativeDefaultValue_only_relative_time_exists.
@Test
public void testRelativeDefaultValue_only_relative_time_exists() {
final Input input = getDefaultInputBuilder(InputTypeName.DATE_TIME, "+1hour -5minutes -36s").inputTypeConfig(InputTypeConfig.create().property(InputTypeProperty.create("timezone", "false").build()).build()).build();
final Value value = this.type.createDefaultValue(input);
assertNotNull(value);
assertSame(ValueTypes.LOCAL_DATE_TIME, value.getType());
}
use of com.enonic.xp.data.Value in project xp by enonic.
the class DateTypeTest method testRelativeDefaultValue.
@Test
public void testRelativeDefaultValue() {
final Input input = getDefaultInputBuilder(InputTypeName.DATE, "+1year -5months -36d").build();
final Value value = this.type.createDefaultValue(input);
assertNotNull(value);
assertSame(ValueTypes.LOCAL_DATE, value.getType());
assertEquals(value.getObject(), LocalDate.now().plusYears(1).plusMonths(-5).plusDays(-36));
}
use of com.enonic.xp.data.Value in project xp by enonic.
the class ImageUploaderTypeTest method testCreateProperty.
@Test
public void testCreateProperty() {
final InputTypeConfig config = InputTypeConfig.create().build();
final Value value = this.type.createValue(ValueFactory.newPropertySet(new PropertySet()), config);
assertNotNull(value);
assertSame(ValueTypes.PROPERTY_SET, value.getType());
}
use of com.enonic.xp.data.Value in project xp by enonic.
the class MediaUploaderTypeTest method testCreateProperty.
@Test
public void testCreateProperty() {
final InputTypeConfig config = InputTypeConfig.create().build();
final Value value = this.type.createValue(ValueFactory.newPropertySet(new PropertySet()), config);
assertNotNull(value);
assertSame(ValueTypes.PROPERTY_SET, value.getType());
}
Aggregations