IsGoodQuality extends FilterFunc { @Override public Boolean exec(Tuple tuple) throws IOException { if (tuple == null || tuple.size() == 0) { return false; } try { Object object = tuple.get(0); if (object == null) { return false; } int i = (Integer) object; return i == 0 || i == 1 || i == 4 || i == 5 || i == 9; } catch (ExecException e) { throw new IOException(e); } }  @Override Boolean exec(Tuple tuple); @Override List<FuncSpec> getArgToFuncMapping();  }
@Test public void nullTuple() throws IOException { assertThat(func.exec(null), is(false)); }
@Test public void emptyTuple() throws IOException { Tuple tuple = TupleFactory.getInstance().newTuple(); assertThat(func.exec(tuple), is(false)); }
@Test public void tupleWithNullField() throws IOException { Tuple tuple = TupleFactory.getInstance().newTuple((Object) null); assertThat(func.exec(tuple), is(false)); }
@Test public void badQuality() throws IOException { Tuple tuple = TupleFactory.getInstance().newTuple(new Integer(2)); assertThat(func.exec(tuple), is(false)); }
@Test public void goodQuality() throws IOException { Tuple tuple = TupleFactory.getInstance().newTuple(new Integer(1)); assertThat(func.exec(tuple), is(true)); }