GetOrElse extends BaseOperation implements Function { public GetOrElse(Tuple value, String name) { super(1, new Fields(name)); if (value.size() != 1) { throw new IllegalArgumentException("tuple size must be 1"); } this.value = value; } GetOrElse(Tuple value, String name); @Override void operate(FlowProcess flowProcess, FunctionCall functionCall);  }
@Test public void testGetOrElse() throws Exception { final Tuple get = new Tuple("get"); final Tuple orElse = new Tuple("else"); List<Tuple> results = TestHelpers.exec( new GetOrElse(orElse, "field"), new Fields("blah"), new Tuple(get), new Tuple((Object)null)); assertEquals(Arrays.asList(new Tuple(get), new Tuple(orElse)), results); }