public static void verifyMapReduce(
     SmartMapper mapper, SmartReducer reducer, Object key, Object input) throws Exception {
   MapDriver mapDriver = new MapDriver();
   mapDriver.setMapper(mapper);
   MapReduceDriver mapReduceDriver = new MapReduceDriver();
   mapReduceDriver.setMapper(mapper);
   Object writableKey = createWritable(key, mapper.getKeyInType());
   Object writableValue = createWritable(input, mapper.getValueInType());
   mapDriver.withInput(writableKey, writableValue);
   List results = mapDriver.run();
   Collections.sort(results, PairComparer.INSTANCE);
   mapReduceDriver =
       new MapReduceDriver<LongWritable, Text, Text, LongWritable, Text, LongWritable>();
   writableKey = createWritable(key, mapper.getKeyInType());
   writableValue = createWritable(input, mapper.getValueInType());
   mapReduceDriver.withInput(writableKey, writableValue);
   mapReduceDriver.setMapper(mapper);
   mapReduceDriver.setReducer(reducer);
   List finalResults = mapReduceDriver.run();
   String text =
       String.format(
           "[%s]\r\n\r\n -> maps via %s to -> \r\n\r\n%s\r\n\r\n -> reduces via %s to -> \r\n\r\n%s",
           input,
           mapper.getClass().getSimpleName(),
           ArrayUtils.toString(results, Echo.INSTANCE),
           reducer.getClass().getSimpleName(),
           ArrayUtils.toString(finalResults, Echo.INSTANCE));
   Approvals.verify(text);
 }
 public static void verifyMapping(SmartMapper mapper, Object key, Object input) throws Exception {
   MapDriver mapDriver = new MapDriver();
   mapDriver.setMapper(mapper);
   Object writableKey = createWritable(key, mapper.getKeyInType());
   Object writableValue = createWritable(input, mapper.getValueInType());
   mapDriver.withInput(writableKey, writableValue);
   List results = mapDriver.run();
   Collections.sort(results, PairComparer.INSTANCE);
   String header =
       String.format(
           "[%s]\r\n\r\n -> maps via %s to -> \r\n", input, mapper.getClass().getSimpleName());
   Approvals.verifyAll(header, results, Echo.INSTANCE);
 }
 public static void verifyReducer(SmartReducer reducer, Object key, Object... values)
     throws Exception {
   List list = new ArrayList();
   for (Object value : values) {
     list.add(createWritable(value, reducer.getValueInType()));
   }
   ReduceDriver reduceDriver = new ReduceDriver<Text, LongWritable, Text, LongWritable>();
   reduceDriver.withInput(createWritable(key, reducer.getKeyInType()), list);
   reduceDriver.setReducer(reducer);
   List results = reduceDriver.run();
   Collections.sort(results, PairComparer.INSTANCE);
   String header =
       String.format(
           "(%s, %s)\r\n\r\n -> reduces via %s to -> \r\n",
           key, list, reducer.getClass().getSimpleName());
   Approvals.verifyAll(header, results, Echo.INSTANCE);
 }
 public void testWeather() throws Exception {
   Approvals.verify(new WeatherLoader("KCASANDI56"));
 }