}
}
@Test
public void testIncorrectParameters() throws Exception {
Tool tool = new InputSampler<Object,Object>(new Configuration());
int result = tool.run(new String[] { "-r" });
assertTrue(result != 0);
result = tool.run(new String[] { "-r", "not-a-number" });
assertTrue(result != 0);
// more than one reducer is required:
result = tool.run(new String[] { "-r", "1" });
assertTrue(result != 0);
try {
result = tool.run(new String[] { "-inFormat", "java.lang.Object" });
fail("ClassCastException expected");
} catch (ClassCastException cce) {
// expected
}
try {
result = tool.run(new String[] { "-keyClass", "java.lang.Object" });
fail("ClassCastException expected");
} catch (ClassCastException cce) {
// expected
}
result = tool.run(new String[] { "-splitSample", "1", });
assertTrue(result != 0);
result = tool.run(new String[] { "-splitRandom", "1.0", "2", "xxx" });
assertTrue(result != 0);
result = tool.run(new String[] { "-splitInterval", "yyy", "5" });
assertTrue(result != 0);
// not enough subsequent arguments:
result = tool.run(new String[] { "-r", "2", "-splitInterval", "11.0f", "0", "input" });
assertTrue(result != 0);
}