+ @Test
+ public void testParseArgs_noParams() throws IOException
+ {
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+ String[] args = {};
+
+ boolean result = m_cfb.parseArgs(pw, args);
+ pw.close();
+ sw.close();
+
+ assertFalse(result);
+ assertEquals("[must.specify.fbp.file]\n[invoke.with.help.for.help]\n", sw.toString());
+ }
+
+ @Test
+ public void testParseArgs_dropTables() throws IOException
+ {
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+ String[] args = { "--drop-tables" };
+
+ boolean result = m_cfb.parseArgs(pw, args);
+ pw.close();
+ sw.close();
+
+ assertTrue(result);
+ assertEquals("", sw.toString());
+ }
+
+ @Test
+ public void testParseArgs_invalidParam() throws IOException
+ {
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+ String[] args = {"--xyzzyaoeuidhtnsl"};
+
+ boolean result = m_cfb.parseArgs(pw, args);
+ pw.close();
+ sw.close();
+ String actual = sw.toString();
+
+ assertFalse(result);
+ assertTrue(actual.contains("usage"));
+ assertTrue(actual.contains("--help"));
+ }
+