use of com.qcadoo.model.api.FieldDefinition in project qcadoo by qcadoo.
the class GridComponentFilterUtilsTest method shouldReturnFieldNameUsingExpressionWithTwoGet.
@Test
public final void shouldReturnFieldNameUsingExpressionWithTwoGet() {
// given
final FieldDefinition fieldDefinition = mockFieldDefinition(TEST_FIELD, Object.class);
final Map<String, GridComponentColumn> columns = ImmutableMap.of(TEST_COL, buildGridComponentColumn(TEST_COL, fieldDefinition, "#belongsTo.get('secondBelongsTo').get('field')"));
// when
final String fieldName = GridComponentFilterUtils.getFieldNameByColumnName(columns, TEST_COL);
// then
assertEquals("belongsTo.secondBelongsTo.field", fieldName);
}
use of com.qcadoo.model.api.FieldDefinition in project qcadoo by qcadoo.
the class GridComponentFilterUtilsTest method shouldReturnNullForUnsupportedExpression2.
@Test
public final void shouldReturnNullForUnsupportedExpression2() {
// given
final FieldDefinition fieldDefinition = mockFieldDefinition(TEST_FIELD, Object.class);
final Map<String, GridComponentColumn> columns = ImmutableMap.of(TEST_COL, buildGridComponentColumn(TEST_COL, fieldDefinition, "'some' + ' concatenated ' + 'value'"));
// when
final String fieldName = GridComponentFilterUtils.getFieldNameByColumnName(columns, TEST_COL);
// then
assertNull(fieldName);
}
use of com.qcadoo.model.api.FieldDefinition in project qcadoo by qcadoo.
the class GridComponentFilterUtilsTest method shouldReturnFieldNameUsingSimpleExpressionWithOneGetBelongsToField.
@Test
public final void shouldReturnFieldNameUsingSimpleExpressionWithOneGetBelongsToField() {
// given
final FieldDefinition fieldDefinition = mockFieldDefinition(TEST_FIELD, Object.class);
final Map<String, GridComponentColumn> columns = ImmutableMap.of(TEST_COL, buildGridComponentColumn(TEST_COL, fieldDefinition, "#belongsTo.getBelongsToField('field')"));
// when
final String fieldName = GridComponentFilterUtils.getFieldNameByColumnName(columns, TEST_COL);
// then
assertEquals("belongsTo.field", fieldName);
}
use of com.qcadoo.model.api.FieldDefinition in project qcadoo by qcadoo.
the class GridComponentFilterUtilsTest method shouldReturnFieldNameUsingSimpleExpressionWithOneGetBooleanField.
@Test
public final void shouldReturnFieldNameUsingSimpleExpressionWithOneGetBooleanField() {
// given
final FieldDefinition fieldDefinition = mockFieldDefinition(TEST_FIELD, Object.class);
final Map<String, GridComponentColumn> columns = ImmutableMap.of(TEST_COL, buildGridComponentColumn(TEST_COL, fieldDefinition, "#belongsTo.getBooleanField('field')"));
// when
final String fieldName = GridComponentFilterUtils.getFieldNameByColumnName(columns, TEST_COL);
// then
assertEquals("belongsTo.field", fieldName);
}
use of com.qcadoo.model.api.FieldDefinition in project qcadoo by qcadoo.
the class GridComponentFilterUtilsTest method shouldReturnFieldNameUsingSimpleExpressionWithOneGetManyToManyField.
@Test
public final void shouldReturnFieldNameUsingSimpleExpressionWithOneGetManyToManyField() {
// given
final FieldDefinition fieldDefinition = mockFieldDefinition(TEST_FIELD, Object.class);
final Map<String, GridComponentColumn> columns = ImmutableMap.of(TEST_COL, buildGridComponentColumn(TEST_COL, fieldDefinition, "#belongsTo.getManyToManyField('field')"));
// when
final String fieldName = GridComponentFilterUtils.getFieldNameByColumnName(columns, TEST_COL);
// then
assertEquals("belongsTo.getManyToManyField('field", fieldName);
}
Aggregations