use of org.talend.dataprep.api.dataset.row.DataSetRow in project data-prep by Talend.
the class CosTest method cos_with_positive_percentage.
@Test
public void cos_with_positive_percentage() {
// given
DataSetRow row = getRow("100%", "3", "Done !");
// when
ActionTestWorkbench.test(row, actionRegistry, factory.create(action, parameters));
// then
assertEquals("0.5403023058681398", row.get("0000"));
}
use of org.talend.dataprep.api.dataset.row.DataSetRow in project data-prep by Talend.
the class CosTest method test_apply_inplace.
@Test
public void test_apply_inplace() throws Exception {
// given
DataSetRow row = getRow("10", "3", "Done !");
// when
ActionTestWorkbench.test(row, actionRegistry, factory.create(action, parameters));
// then
assertEquals(3, row.getRowMetadata().size());
assertEquals("-0.8390715290764524", row.get("0000"));
}
use of org.talend.dataprep.api.dataset.row.DataSetRow in project data-prep by Talend.
the class CosTest method test_apply_in_newcolumn.
@Test
public void test_apply_in_newcolumn() {
// given
DataSetRow row = getRow("10", "3", "Done !");
parameters.put(CREATE_NEW_COLUMN, "true");
// when
ActionTestWorkbench.test(row, actionRegistry, factory.create(action, parameters));
// then
assertColumnWithResultCreated(row);
assertEquals("-0.8390715290764524", row.get("0003"));
}
use of org.talend.dataprep.api.dataset.row.DataSetRow in project data-prep by Talend.
the class DeleteNegativeValuesTest method should_delete_even_with_trailing_space.
@Test
public void should_delete_even_with_trailing_space() {
// given
final Map<String, String> values = new HashMap<>();
values.put("0000", "David Bowie");
// notice the space after '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_delete_alt_format_2.
@Test
public void should_delete_alt_format_2() {
// given
final Map<String, String> values = new HashMap<>();
values.put("0000", "David Bowie");
values.put("0001", "(1 200,55)");
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"));
}
Aggregations