use of org.talend.dataprep.api.dataset.ColumnMetadata in project data-prep by Talend.
the class SinTest method assertColumnWithResultCreated.
private void assertColumnWithResultCreated(DataSetRow row) {
ColumnMetadata expected = ColumnMetadata.Builder.column().id(3).name("0000_sin").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 SquareRootTest method assertColumnWithResultCreated.
private void assertColumnWithResultCreated(DataSetRow row) {
ColumnMetadata expected = ColumnMetadata.Builder.column().id(3).name("0000_square_root").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 ExtractEmailDomainTest method should_not_accept_column.
@Test
public void should_not_accept_column() {
assertFalse(action.acceptField(getColumn(Type.STRING)));
assertFalse(action.acceptField(getColumn(Type.DATE)));
assertFalse(action.acceptField(getColumn(Type.BOOLEAN)));
assertFalse(action.acceptField(getColumn(Type.NUMERIC)));
assertFalse(action.acceptField(getColumn(Type.INTEGER)));
assertFalse(action.acceptField(getColumn(Type.DOUBLE)));
assertFalse(action.acceptField(getColumn(Type.FLOAT)));
ColumnMetadata column = getColumn(Type.STRING);
column.setDomain("not an email");
assertFalse(action.acceptField(column));
}
use of org.talend.dataprep.api.dataset.ColumnMetadata in project data-prep by Talend.
the class ExtractEmailDomainTest method should_accept_column.
@Test
public void should_accept_column() {
ColumnMetadata column = getColumn(Type.STRING);
column.setDomain("email");
assertTrue(action.acceptField(column));
}
use of org.talend.dataprep.api.dataset.ColumnMetadata in project data-prep by Talend.
the class ExtractEmailDomainTest method test_metadata.
@Test
public void test_metadata() {
// given
final List<ColumnMetadata> input = new ArrayList<>();
input.add(createMetadata("0000", "recipe"));
input.add(createMetadata("0001", "email"));
input.add(createMetadata("0002", "last update"));
final DataSetRow row = new DataSetRow(new RowMetadata(input));
final List<ColumnMetadata> expected = new ArrayList<>();
expected.add(createMetadata("0000", "recipe"));
expected.add(createMetadata("0001", "email"));
expected.add(createMetadata("0003", "email_local"));
expected.add(createMetadata("0004", "email_domain"));
expected.add(createMetadata("0002", "last update"));
// when
ActionTestWorkbench.test(row, actionRegistry, factory.create(action, parameters));
// then
assertEquals(expected, row.getRowMetadata().getColumns());
}
Aggregations