use of org.talend.dataprep.api.dataset.row.DataSetRow in project data-prep by Talend.
the class DeleteNegativeValuesTest method should_delete_even_with_enclosing_spaces.
@Test
public void should_delete_even_with_enclosing_spaces() {
// given
final Map<String, String> values = new HashMap<>();
values.put("0000", "David Bowie");
// notice the spaces enclosing ' Berlin '
values.put("0001", " -12 ");
final DataSetRow row = new DataSetRow(values);
// when
ActionTestWorkbench.test(row, actionRegistry, factory.create(action, parameters));
// then
assertTrue(row.isDeleted());
assertEquals("David Bowie", row.get("0000"));
assertEquals(" -12 ", row.get("0001"));
}
use of org.talend.dataprep.api.dataset.row.DataSetRow in project data-prep by Talend.
the class DeleteNegativeValuesTest method should_not_delete_because_null_value.
@Test
public void should_not_delete_because_null_value() {
// given
final Map<String, String> values = new HashMap<>();
values.put("name", "Michael Jordan");
values.put("age", null);
final DataSetRow row = new DataSetRow(values);
// when
ActionTestWorkbench.test(row, actionRegistry, factory.create(action, parameters));
// then
assertFalse(row.isDeleted());
assertEquals("Michael Jordan", row.get("name"));
values.put("age", null);
}
use of org.talend.dataprep.api.dataset.row.DataSetRow in project data-prep by Talend.
the class DeleteNegativeValuesTest method should_delete_even_with_leading_space.
@Test
public void should_delete_even_with_leading_space() {
// given
final Map<String, String> values = new HashMap<>();
values.put("0000", "David Bowie");
// notice the space before ' Berlin'
values.put("0001", " -12");
final DataSetRow row = new DataSetRow(values);
// when
ActionTestWorkbench.test(row, actionRegistry, factory.create(action, parameters));
// then
assertTrue(row.isDeleted());
assertEquals("David Bowie", row.get("0000"));
assertEquals(" -12", row.get("0001"));
}
use of org.talend.dataprep.api.dataset.row.DataSetRow in project data-prep by Talend.
the class DeleteNegativeValuesTest method should_not_delete_because_value_different.
@Test
public void should_not_delete_because_value_different() {
// given
final Map<String, String> values = new HashMap<>();
values.put("0000", "David Bowie");
values.put("0001", "68");
final DataSetRow row = new DataSetRow(values);
// when
ActionTestWorkbench.test(row, actionRegistry, factory.create(action, parameters));
// then
assertFalse(row.isDeleted());
assertEquals("David Bowie", row.get("0000"));
assertEquals("68", row.get("0001"));
}
use of org.talend.dataprep.api.dataset.row.DataSetRow in project data-prep by Talend.
the class DeleteNegativeValuesTest method should_not_delete_percentage.
@Test
public void should_not_delete_percentage() {
// given
final Map<String, String> values = new HashMap<>();
values.put("0000", "David Bowie");
values.put("0001", "12%");
final DataSetRow row = new DataSetRow(values);
// when
ActionTestWorkbench.test(row, actionRegistry, factory.create(action, parameters));
// then
assertFalse(row.isDeleted());
assertEquals("David Bowie", row.get("0000"));
assertEquals("12%", row.get("0001"));
}
Aggregations