use of org.talend.dataprep.api.dataset.ColumnMetadata in project data-prep by Talend.
the class DeleteNegativeValuesTest 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 ExponentialTest method assertColumnWithResultCreated.
private void assertColumnWithResultCreated(DataSetRow row) {
ColumnMetadata expected = ColumnMetadata.Builder.column().id(3).name("0000_exponential").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 RemoveNonAlphaNumCharsTest 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", "€10k");
values.put("0002", "May 20th 2015");
final DataSetRow row = new DataSetRow(values);
final Map<String, Object> expectedValues = new LinkedHashMap<>();
expectedValues.put("0000", "Vincent");
expectedValues.put("0001", "€10k");
expectedValues.put("0003", "10k");
expectedValues.put("0002", "May 20th 2015");
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_only_alpha").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 RemoveNonNumCharsTest 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 RemoveRepeatedCharsTest method test_apply_in_newcolumn.
@Test
public void test_apply_in_newcolumn() {
// given
final Map<String, String> values = new LinkedHashMap<>();
values.put("0000", "ab c d");
values.put("0001", "tagadaa");
values.put("0002", "May 20th 2015");
final DataSetRow row = new DataSetRow(values);
final Map<String, Object> expectedValues = new LinkedHashMap<>();
expectedValues.put("0000", "ab c d");
expectedValues.put("0003", "ab c d");
expectedValues.put("0001", "tagadaa");
expectedValues.put("0002", "May 20th 2015");
initParametersWhitespace();
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_without_consecutive").type(Type.STRING).build();
ColumnMetadata actual = row.getRowMetadata().getById("0003");
assertEquals(expected, actual);
}
Aggregations