DatasetSplit { public void storeJobParameters(Configuration conf) { conf.set(SEED, String.valueOf(seed)); conf.set(THRESHOLD, Double.toString(threshold)); conf.setBoolean(TRAINING, training); } DatasetSplit(long seed, double threshold);  DatasetSplit(double threshold);  DatasetSplit(Configuration conf); long getSeed(); double getThreshold(); boolean isTraining(); void setTraining(boolean training); void storeJobParameters(Configuration conf);  }
@Test public void testStoreJobParameters() { int n = 20; for (int nloop = 0; nloop < n; nloop++) { RandomWrapper rng = (RandomWrapper) RandomUtils.getRandom(); long seed = rng.getSeed(); double threshold = rng.nextDouble(); boolean training = rng.nextBoolean(); DatasetSplit split = new DatasetSplit(seed, threshold); split.setTraining(training); Configuration conf = new Configuration(); split.storeJobParameters(conf); assertEquals("bad seed", seed, DatasetSplit.getSeed(conf)); assertEquals("bad threshold", threshold, DatasetSplit.getThreshold(conf), EPSILON); assertEquals("bad training", training, DatasetSplit.isTraining(conf)); } }