use of org.talend.dataprep.api.dataset.ColumnMetadata in project data-prep by Talend.
the class CutTest method test_apply_in_newcolumn.
@Test
public void test_apply_in_newcolumn() {
// given
DataSetRow row = getRow("Wait for it...", "The value that gets cut !", "Done !");
DataSetRow expectedRow = getRow("Wait for it...", "The value that gets cut !", "Done !", "value that gets cut !");
parameters.put(ActionsUtils.CREATE_NEW_COLUMN, "true");
// when
ActionTestWorkbench.test(row, actionRegistry, factory.create(action, parameters));
// then
assertEquals(expectedRow, row);
ColumnMetadata expected = ColumnMetadata.Builder.column().id(3).name("0001_cut").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 ExtractStringTokensTest method should_update_metadata_twice.
@Test
public void should_update_metadata_twice() {
// given
final List<ColumnMetadata> input = new ArrayList<>();
input.add(createMetadata("0000", "recipe"));
input.add(createMetadata("0001", "steps"));
input.add(createMetadata("0002", "last update"));
final RowMetadata rowMetadata = new RowMetadata(input);
final List<ColumnMetadata> expected = new ArrayList<>();
expected.add(createMetadata("0000", "recipe"));
expected.add(createMetadata("0001", "steps"));
expected.add(createMetadata("0005", "steps_part_1"));
expected.add(createMetadata("0006", "steps_part_2"));
expected.add(createMetadata("0003", "steps_part_1"));
expected.add(createMetadata("0004", "steps_part_2"));
expected.add(createMetadata("0002", "last update"));
// when
ActionTestWorkbench.test(rowMetadata, actionRegistry, factory.create(action, parameters), factory.create(action, parameters));
assertEquals(expected, rowMetadata.getColumns());
}
use of org.talend.dataprep.api.dataset.ColumnMetadata in project data-prep by Talend.
the class ExtractStringTokensTest 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 LowerCaseTest 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 MatchesPatternTest 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));
}
Aggregations