use of org.talend.dataprep.api.dataset.ColumnMetadata in project data-prep by Talend.
the class PaddingTest method test_apply_in_newcolumn.
@Test
public void test_apply_in_newcolumn() {
// given
final Map<String, String> values = new HashMap<>();
values.put("0000", "Vincent");
values.put("0001", "10");
values.put("0002", "May 20th 2015");
final DataSetRow row = new DataSetRow(values);
final Map<String, Object> expectedValues = new HashMap<>();
expectedValues.put("0000", "Vincent");
expectedValues.put("0001", "10");
expectedValues.put("0002", "May 20th 2015");
expectedValues.put("0003", "0010");
parameters.put(CREATE_NEW_COLUMN, "true");
// when
ActionTestWorkbench.test(row, actionRegistry, factory.create(action, parameters));
// then
assertEquals(expectedValues, row.values());
ColumnMetadata expected = ColumnMetadata.Builder.column().id(3).name("0000_padded").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 ProperCaseTest 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 ProperCaseTest method test_apply_in_newcolumn.
@Test
public void test_apply_in_newcolumn() {
// given
final Map<String, String> values = new LinkedHashMap<>();
values.put("0000", "jimi HENDRIX experience");
values.put("0001", "experience");
values.put("0002", "May 20th 2015");
final DataSetRow row = new DataSetRow(values);
final Map<String, Object> expectedValues = new LinkedHashMap<>();
expectedValues.put("0000", "jimi HENDRIX experience");
expectedValues.put("0001", "experience");
expectedValues.put("0002", "May 20th 2015");
expectedValues.put("0003", "Jimi Hendrix Experience");
parameters.put(ActionsUtils.CREATE_NEW_COLUMN, "true");
// when
ActionTestWorkbench.test(row, actionRegistry, factory.create(action, parameters));
// then
assertEquals(expectedValues, row.values());
ColumnMetadata expected = ColumnMetadata.Builder.column().id(3).name("0000_title").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 LogarithmTest method assertColumnWithResultCreated.
private void assertColumnWithResultCreated(DataSetRow row) {
ColumnMetadata expected = ColumnMetadata.Builder.column().id(3).name("0000_logarithm").type(Type.DOUBLE).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 MinTest method assertColumnWithResultCreated.
private void assertColumnWithResultCreated(DataSetRow row) {
ColumnMetadata expected = ColumnMetadata.Builder.column().id(3).name("0000_min").type(Type.DOUBLE).build();
ColumnMetadata actual = row.getRowMetadata().getById("0003");
assertEquals(expected, actual);
}
Aggregations