use of org.talend.dataprep.api.dataset.ColumnMetadata in project data-prep by Talend.
the class ChangeNumberFormatTest method test_apply_in_newcolumn_with_empty_value.
@Test
public void test_apply_in_newcolumn_with_empty_value() throws Exception {
// given
final DataSetRow row = getRow("toto", "", "tata");
parameters.put(ActionsUtils.CREATE_NEW_COLUMN, "true");
// when
ActionTestWorkbench.test(row, actionRegistry, factory.create(action, parameters));
// then
final DataSetRow expectedRow = getRow("toto", "", "tata", "");
assertEquals(expectedRow.values(), row.values());
ColumnMetadata expected = ColumnMetadata.Builder.column().id(3).name("0001_formatted").type(Type.STRING).build();
ColumnMetadata actual = row.getRowMetadata().getById("0003");
assertEquals(expected, actual);
}
use of org.talend.dataprep.api.dataset.ColumnMetadata in project data-prep by Talend.
the class CompareNumbersTest method should_set_new_column_name_constant.
@Test
public void should_set_new_column_name_constant() {
// given
final DataSetRow row = //
builder().with(//
value("5").type(Type.STRING).name("source")).with(//
value("3").type(Type.STRING).name("selected")).with(//
value("Done !").type(Type.STRING)).build();
parameters.put(CompareNumbers.MODE_PARAMETER, CompareNumbers.CONSTANT_MODE);
parameters.put(CompareNumbers.CONSTANT_VALUE, "3");
// when
ActionTestWorkbench.test(row, actionRegistry, factory.create(action, parameters));
// then
final ColumnMetadata expected = ColumnMetadata.Builder.column().id(3).name("source_eq_3?").type(Type.BOOLEAN).build();
ColumnMetadata actual = row.getRowMetadata().getById("0003");
assertEquals(expected, actual);
}
use of org.talend.dataprep.api.dataset.ColumnMetadata in project data-prep by Talend.
the class CompareNumbersTest method should_set_new_column_name.
@Test
public void should_set_new_column_name() {
// given
final DataSetRow row = //
builder().with(//
value("5").type(Type.STRING).name("source")).with(//
value("3").type(Type.STRING).name("selected")).with(//
value("Done !").type(Type.STRING)).build();
// when
ActionTestWorkbench.test(row, actionRegistry, factory.create(action, parameters));
// then
final ColumnMetadata expected = ColumnMetadata.Builder.column().id(3).name("source_eq_selected?").type(Type.BOOLEAN).build();
ColumnMetadata actual = row.getRowMetadata().getById("0003");
assertEquals(expected, actual);
}
use of org.talend.dataprep.api.dataset.ColumnMetadata in project data-prep by Talend.
the class CompareNumbersTest method testAdapt.
@Test
public void testAdapt() throws Exception {
assertThat(action.adapt((ColumnMetadata) null), is(action));
ColumnMetadata column = column().name("myColumn").id(0).type(Type.STRING).build();
assertThat(action.adapt(column), is(action));
}
use of org.talend.dataprep.api.dataset.ColumnMetadata in project data-prep by Talend.
the class CosTest method assertColumnWithResultCreated.
private void assertColumnWithResultCreated(DataSetRow row) {
ColumnMetadata expected = ColumnMetadata.Builder.column().id(3).name("0000_cos").type(Type.DOUBLE).build();
ColumnMetadata actual = row.getRowMetadata().getById("0003");
assertEquals(expected, actual);
}
Aggregations