@Test public void testSingleWordLowerCasing() throws Exception { String[] directives = new String[] { "lowercase body", }; List<Row> rows = Arrays.asList( new Row("body", "TITLE"), new Row("body", "tiTLE"), new Row("body", "title"), new Row("body", "TitlE") ); rows = TestingRig.execute(directives, rows); Assert.assertEquals(4, rows.size()); Assert.assertEquals("title", rows.get(0).getValue("body")); Assert.assertEquals("title", rows.get(1).getValue("body")); Assert.assertEquals("title", rows.get(2).getValue("body")); Assert.assertEquals("title", rows.get(3).getValue("body")); }
@Override public List<Row> execute(List<Row> rows, ExecutorContext context) throws DirectiveExecutionException { for (Row row : rows) { int idx = row.find(column); if (idx != -1) { Object object = row.getValue(idx); if (object instanceof String) { if (object != null) { String value = (String) object; row.setValue(idx, value.toLowerCase()); } } } } return rows; }
Lower implements Directive, Lineage { @Override public List<Row> execute(List<Row> rows, ExecutorContext context) throws DirectiveExecutionException { for (Row row : rows) { int idx = row.find(column); if (idx != -1) { Object object = row.getValue(idx); if (object instanceof String) { if (object != null) { String value = (String) object; row.setValue(idx, value.toLowerCase()); } } } } return rows; } }
Lower implements Directive, Lineage { @Override public List<Row> execute(List<Row> rows, ExecutorContext context) throws DirectiveExecutionException { for (Row row : rows) { int idx = row.find(column); if (idx != -1) { Object object = row.getValue(idx); if (object instanceof String) { if (object != null) { String value = (String) object; row.setValue(idx, value.toLowerCase()); } } } } return rows; }  }
Lower implements Directive, Lineage { @Override public List<Row> execute(List<Row> rows, ExecutorContext context) throws DirectiveExecutionException { for (Row row : rows) { int idx = row.find(column); if (idx != -1) { Object object = row.getValue(idx); if (object instanceof String) { if (object != null) { String value = (String) object; row.setValue(idx, value.toLowerCase()); } } } } return rows; }  @Override UsageDefinition define(); @Override void initialize(Arguments args); @Override void destroy(); @Override List<Row> execute(List<Row> rows, ExecutorContext context); @Override Mutation lineage(); }
Lower implements Directive, Lineage { @Override public List<Row> execute(List<Row> rows, ExecutorContext context) throws DirectiveExecutionException { for (Row row : rows) { int idx = row.find(column); if (idx != -1) { Object object = row.getValue(idx); if (object instanceof String) { if (object != null) { String value = (String) object; row.setValue(idx, value.toLowerCase()); } } } } return rows; }  @Override UsageDefinition define(); @Override void initialize(Arguments args); @Override void destroy(); @Override List<Row> execute(List<Row> rows, ExecutorContext context); @Override Mutation lineage(); static final String NAME; }