@Test public void processOptionsNoExpression() throws IOException { Find find = new Find(); find.setConf(conf); String args = "path"; String expected = "Print(;)"; find.processOptions(getArgs(args)); Expression expression = find.getRootExpression(); assertEquals(expected, expression.toString()); }
@Test public void processOptionsName() throws IOException { Find find = new Find(); find.setConf(conf); String args = "path -name namemask"; String expected = "And(;Name(namemask;),Print(;))"; find.processOptions(getArgs(args)); Expression expression = find.getRootExpression(); assertEquals(expected, expression.toString()); }
@Test public void processOptionsIname() throws IOException { Find find = new Find(); find.setConf(conf); String args = "path -iname namemask"; String expected = "And(;Iname-Name(namemask;),Print(;))"; find.processOptions(getArgs(args)); Expression expression = find.getRootExpression(); assertEquals(expected, expression.toString()); }
@Test public void processOptionsPrint() throws IOException { Find find = new Find(); find.setConf(conf); String args = "path -print"; String expected = "Print(;)"; find.processOptions(getArgs(args)); Expression expression = find.getRootExpression(); assertEquals(expected, expression.toString()); }
@Test public void processOptionsPrint0() throws IOException { Find find = new Find(); find.setConf(conf); String args = "path -print0"; String expected = "Print0-Print(;)"; find.processOptions(getArgs(args)); Expression expression = find.getRootExpression(); assertEquals(expected, expression.toString()); }
@Test public void processOptionsNoop() throws IOException { Find find = new Find(); find.setConf(conf); String args = "path -name one -name two -print"; String expected = "And(;And(;Name(one;),Name(two;)),Print(;))"; find.processOptions(getArgs(args)); Expression expression = find.getRootExpression(); assertEquals(expected, expression.toString()); }
@Test public void processOptionsA() throws IOException { Find find = new Find(); find.setConf(conf); String args = "path -name one -a -name two -a -print"; String expected = "And(;And(;Name(one;),Name(two;)),Print(;))"; find.processOptions(getArgs(args)); Expression expression = find.getRootExpression(); assertEquals(expected, expression.toString()); }
@Test public void processOptionsAnd() throws IOException { Find find = new Find(); find.setConf(conf); String args = "path -name one -and -name two -and -print"; String expected = "And(;And(;Name(one;),Name(two;)),Print(;))"; find.processOptions(getArgs(args)); Expression expression = find.getRootExpression(); assertEquals(expected, expression.toString()); }
@Test(timeout = 1000) public void processOptionsNoExpression() throws IOException { Find find = new Find(); find.setConf(conf); String args = "path"; String expected = "Print(;)"; find.processOptions(getArgs(args)); Expression expression = find.getRootExpression(); assertEquals(expected, expression.toString()); }
@Test(timeout = 1000) public void processOptionsName() throws IOException { Find find = new Find(); find.setConf(conf); String args = "path -name namemask"; String expected = "And(;Name(namemask;),Print(;))"; find.processOptions(getArgs(args)); Expression expression = find.getRootExpression(); assertEquals(expected, expression.toString()); }
@Test(timeout = 1000) public void processOptionsIname() throws IOException { Find find = new Find(); find.setConf(conf); String args = "path -iname namemask"; String expected = "And(;Iname-Name(namemask;),Print(;))"; find.processOptions(getArgs(args)); Expression expression = find.getRootExpression(); assertEquals(expected, expression.toString()); }
@Test(timeout = 1000) public void processOptionsPrint() throws IOException { Find find = new Find(); find.setConf(conf); String args = "path -print"; String expected = "Print(;)"; find.processOptions(getArgs(args)); Expression expression = find.getRootExpression(); assertEquals(expected, expression.toString()); }
@Test(timeout = 1000) public void processOptionsPrint0() throws IOException { Find find = new Find(); find.setConf(conf); String args = "path -print0"; String expected = "Print0-Print(;)"; find.processOptions(getArgs(args)); Expression expression = find.getRootExpression(); assertEquals(expected, expression.toString()); }
@Test(timeout = 1000) public void processOptionsNoop() throws IOException { Find find = new Find(); find.setConf(conf); String args = "path -name one -name two -print"; String expected = "And(;And(;Name(one;),Name(two;)),Print(;))"; find.processOptions(getArgs(args)); Expression expression = find.getRootExpression(); assertEquals(expected, expression.toString()); }
@Test(timeout = 1000) public void processOptionsA() throws IOException { Find find = new Find(); find.setConf(conf); String args = "path -name one -a -name two -a -print"; String expected = "And(;And(;Name(one;),Name(two;)),Print(;))"; find.processOptions(getArgs(args)); Expression expression = find.getRootExpression(); assertEquals(expected, expression.toString()); }
@Test(timeout = 1000) public void processOptionsAnd() throws IOException { Find find = new Find(); find.setConf(conf); String args = "path -name one -and -name two -and -print"; String expected = "And(;And(;Name(one;),Name(two;)),Print(;))"; find.processOptions(getArgs(args)); Expression expression = find.getRootExpression(); assertEquals(expected, expression.toString()); }