use of org.talend.dataprep.api.dataset.row.DataSetRow in project data-prep by Talend.
the class ExponentialTest method exponential_with_negative.
@Test
public void exponential_with_negative() {
// given
DataSetRow row = getRow("-3", "3", "Done !");
parameters.put(ActionsUtils.CREATE_NEW_COLUMN, "true");
// when
ActionTestWorkbench.test(row, actionRegistry, factory.create(action, parameters));
// then
assertColumnWithResultCreated(row);
assertEquals("0.049787068367863944", row.get("0003"));
}
use of org.talend.dataprep.api.dataset.row.DataSetRow in project data-prep by Talend.
the class ExponentialTest method exponential_with_NaN.
@Test
public void exponential_with_NaN() {
// given
DataSetRow row = getRow("beer", "3", "Done !");
parameters.put(ActionsUtils.CREATE_NEW_COLUMN, "true");
// when
ActionTestWorkbench.test(row, actionRegistry, factory.create(action, parameters));
// then
assertColumnWithResultCreated(row);
assertEquals(StringUtils.EMPTY, row.get("0003"));
}
use of org.talend.dataprep.api.dataset.row.DataSetRow 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.row.DataSetRow in project data-prep by Talend.
the class RemoveNonNumCharsTest method test_apply_inplace.
@Test
public void test_apply_inplace() {
// 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", "10");
expectedValues.put("0002", "May 20th 2015");
// when
ActionTestWorkbench.test(row, actionRegistry, factory.create(action, parameters));
// then
assertEquals(expectedValues, row.values());
}
use of org.talend.dataprep.api.dataset.row.DataSetRow in project data-prep by Talend.
the class RemoveRepeatedCharsTest method should_not_remove_empty_parameter.
@Test
public void should_not_remove_empty_parameter() {
// given
final Map<String, String> values = new HashMap<>();
values.put("0000", "abcc");
final DataSetRow row = new DataSetRow(values);
parameters = new HashMap<>();
parameters.put(ImplicitParameters.SCOPE.getKey().toLowerCase(), "column");
parameters.put(ImplicitParameters.COLUMN_ID.getKey().toLowerCase(), "0000");
parameters.put(RemoveRepeatedChars.REMOVE_TYPE, "");
// when
ActionTestWorkbench.test(row, actionRegistry, factory.create(action, parameters));
// then
assertEquals("abcc", row.get("0000"));
}
Aggregations