use of org.talend.dataprep.transformation.actions.delete.DeleteEmpty in project data-prep by Talend.
the class SimpleSuggestionEngineTest method shouldSuggestionsShouldBeSorted.
@Test
public void shouldSuggestionsShouldBeSorted() throws IOException {
final String json = IOUtils.toString(this.getClass().getResourceAsStream("sample_column.json"), UTF_8);
ObjectMapper mapper = new ObjectMapper();
final ColumnMetadata columnMetadata = mapper.readValue(json, ColumnMetadata.class);
List<ActionDefinition> actions = new ArrayList<>();
actions.add(new FillIfEmpty());
actions.add(new FillInvalid());
actions.add(new DeleteInvalid());
actions.add(new DeleteEmpty());
actions.add(new Absolute());
actions.add(new UpperCase());
final Stream<Suggestion> suggestions = engine.score(actions.stream(), columnMetadata);
int currentScore = Integer.MAX_VALUE;
for (Suggestion suggestion : suggestions.collect(Collectors.toList())) {
assertTrue(currentScore >= suggestion.getScore());
currentScore = suggestion.getScore();
}
}
Aggregations