use of org.talend.dataprep.api.dataset.row.DataSetRow in project data-prep by Talend.
the class ChangeNumberFormatTest method should_process_row_alt_pattern_alt_seps.
@Test
public void should_process_row_alt_pattern_alt_seps() throws Exception {
// given
final DataSetRow row = getRow("toto", "1012.45", "tata");
parameters.put(TARGET_PATTERN, CUSTOM);
parameters.put(TARGET_PATTERN + "_" + CUSTOM, "#,##0.000");
parameters.put(TARGET + DECIMAL + SEPARATOR, "/");
parameters.put(TARGET + GROUPING + SEPARATOR, "_");
// when
ActionTestWorkbench.test(row, actionRegistry, factory.create(action, parameters));
// then
final DataSetRow expectedRow = getRow("toto", "1_012/450", "tata");
assertEquals(expectedRow.values(), row.values());
}
use of org.talend.dataprep.api.dataset.row.DataSetRow in project data-prep by Talend.
the class ChangeNumberFormatTest method should_process_row_when_value_is_empty.
@Test
public void should_process_row_when_value_is_empty() throws Exception {
// given
DataSetRow row = getRow("toto", "", "tata");
// when
ActionTestWorkbench.test(row, actionRegistry, factory.create(action, parameters));
// then (values should be unchanged)
final DataSetRow expectedRow = getRow("toto", "", "tata");
assertEquals(expectedRow.values(), row.values());
}
use of org.talend.dataprep.api.dataset.row.DataSetRow in project data-prep by Talend.
the class ChangeNumberFormatTest method test_TDP_1108_empty_pattern.
@Test
public void test_TDP_1108_empty_pattern() throws Exception {
// given
final DataSetRow row = getRow("toto", "012.50", "tata");
parameters.put(TARGET_PATTERN, "custom");
parameters.put(TARGET_PATTERN + "_" + CUSTOM, "");
// when
ActionTestWorkbench.test(row, actionRegistry, factory.create(action, parameters));
// then
final DataSetRow expectedRow = getRow("toto", "12.5", "tata");
assertEquals(expectedRow.values(), row.values());
}
use of org.talend.dataprep.api.dataset.row.DataSetRow in project data-prep by Talend.
the class ChangeNumberFormatTest method should_process_row_percentage.
@Test
public void should_process_row_percentage() throws Exception {
// given
final DataSetRow row = getRow("toto", "12.50%", "tata");
// when
ActionTestWorkbench.test(row, actionRegistry, factory.create(action, parameters));
// then
final DataSetRow expectedRow = getRow("toto", "0.12", "tata");
assertEquals(expectedRow.values(), row.values());
}
use of org.talend.dataprep.api.dataset.row.DataSetRow in project data-prep by Talend.
the class CompareNumbersTest method should_set_new_column_name_constant.
@Test
public void should_set_new_column_name_constant() {
// given
final DataSetRow row = //
builder().with(//
value("5").type(Type.STRING).name("source")).with(//
value("3").type(Type.STRING).name("selected")).with(//
value("Done !").type(Type.STRING)).build();
parameters.put(CompareNumbers.MODE_PARAMETER, CompareNumbers.CONSTANT_MODE);
parameters.put(CompareNumbers.CONSTANT_VALUE, "3");
// when
ActionTestWorkbench.test(row, actionRegistry, factory.create(action, parameters));
// then
final ColumnMetadata expected = ColumnMetadata.Builder.column().id(3).name("source_eq_3?").type(Type.BOOLEAN).build();
ColumnMetadata actual = row.getRowMetadata().getById("0003");
assertEquals(expected, actual);
}
Aggregations