use of org.talend.dataprep.api.dataset.ColumnMetadata in project data-prep by Talend.
the class NumericOperationsTest 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 FillWithDateTest method test_adapt.
@Test
public void test_adapt() throws Exception {
assertThat(action.adapt((ColumnMetadata) null), is(action));
ColumnMetadata column = column().name("myColumn").id(0).type(Type.DATE).build();
assertThat(action.adapt(column), is(action));
}
use of org.talend.dataprep.api.dataset.ColumnMetadata in project data-prep by Talend.
the class FillWithIntegerIfEmptyTest method test_adapt.
@Test
public void test_adapt() throws Exception {
assertThat(action.adapt((ColumnMetadata) null), is(action));
ColumnMetadata column = column().name("myColumn").id(0).type(Type.INTEGER).build();
assertThat(action.adapt(column), not(is(action)));
}
use of org.talend.dataprep.api.dataset.ColumnMetadata in project data-prep by Talend.
the class FillWithStringIfEmptyTest method test_adapt.
@Test
public void test_adapt() throws Exception {
assertThat(action.adapt((ColumnMetadata) null), is(action));
ColumnMetadata column = column().name("myColumn").id(0).type(Type.STRING).build();
assertThat(action.adapt(column), not(is(action)));
}
use of org.talend.dataprep.api.dataset.ColumnMetadata in project data-prep by Talend.
the class GenerateSequenceTest method test_apply_in_newcolumn.
@Test
public void test_apply_in_newcolumn() throws Exception {
// given
final DataSetRow row = getRow("toto", "0012.50", "tata");
row.setTdpId(1L);
Map<String, String> parameters = new HashMap<>();
parameters.put(ImplicitParameters.SCOPE.getKey().toLowerCase(), "column");
parameters.put(ImplicitParameters.COLUMN_ID.getKey().toLowerCase(), "0000");
parameters.put(GenerateSequence.START_VALUE, "0");
parameters.put(GenerateSequence.STEP_VALUE, "2");
// when
ActionTestWorkbench.test(row, actionRegistry, factory.create(action, parameters));
// then
final DataSetRow expectedRow = getRow("toto", "0012.50", "tata", "0");
assertEquals(expectedRow.values(), row.values());
ColumnMetadata expected = ColumnMetadata.Builder.column().id(3).name("0000_sequence").type(Type.STRING).build();
ColumnMetadata actual = row.getRowMetadata().getById("0003");
assertEquals(expected, actual);
}
Aggregations