### Question:
BundleFilterRandomField implements BundleFilter { @Override public boolean filter(Bundle bundle) { List<AutoField> inFieldsShuffle = new ArrayList<>(Arrays.asList(inFields)); Collections.shuffle(inFieldsShuffle); for (AutoField bf : inFieldsShuffle) { if (bf != null && bf.getValue(bundle) != null) { out.setValue(bundle, bf.getValue(bundle)); break; } } return true; } @JsonCreator  BundleFilterRandomField(@JsonProperty(value = "inFields", required = true) AutoField[] inFields,
                                   @JsonProperty(value = "out", required = true) AutoField out); @Override boolean filter(Bundle bundle);  }### Answer:
@Test public void fieldTest() throws IOException { BundleFilterRandomField bfrf = Configs.decodeObject( BundleFilterRandomField.class, "{op:\"random-field\", inFields:[\"f0\", \"f1\"], " + "out:\"out0\"}"); MapBundle bundle = MapBundle.createBundle(new String[]{"f0", "foo", "f1", "bar"}); bfrf.filter(bundle); assertTrue(bundle.get("out0").equals("foo") || bundle.get("out0").equals("bar")); }
@Test public void fieldTestNull() throws IOException { BundleFilterRandomField bfrf = Configs.decodeObject( BundleFilterRandomField.class, "{op:\"random-field\", inFields:[\"f0\", \"f1\"], " + "out:\"out0\"}"); MapBundle bundle = MapBundle.createBundle(new String[]{"f0", null, "f1", "bar"}); bfrf.filter(bundle); assertEquals("bar", bundle.get("out0")); }