Define a state: Each represents the 10 ounces, 7ounces, and 3 ounces bottle. Define the Operation ： multiAndPlus(X, b) Eg: pour 10 ounces from the first(10o) bottle to the third one.
@After Assert* And last, RUN in Java Normal Application.
MRUnit, Unit Test for Hadoop Mapreduce
MapDriver ReduceDriver MapReduceDriver withInput(key, value) withOutput(key, value) runTest() And last, RUN in Java Normal Application.
The Art of Assertion in CH5 of Programming Pearls, Second Edition. Assert in Java assert assert : But, you must run the application with enabling assertions implicitly.(java -ea ) Precondition in Guava
Guava, Google Core Libraries for Java 1.6+ Preconditions checkArgument(i >= 0, "Argument was %s but expected nonnegative", i); checkArgument(i %s", i, j);
Other useful libraries.
自定义数据类型 CustomType 自定义 Partitioner
Partitioner: return Key % 3 When change to: (return key / 3), and change the number of reduce tasks to 4 Totally ordering.