@Test public void testGetTextFiles() throws Exception {
FileExecutionFactory fef = new FileExecutionFactory();
FileConnection fc = Mockito.mock(FileConnection.class);
Mockito.stub(fc.getFile("*.txt")).toReturn(new File(UnitTestUtil.getTestDataPath(), "*.txt"));
Call call = fef.getLanguageFactory().createCall("getTextFiles", Arrays.asList(new Argument(Direction.IN, new Literal("*.txt", TypeFacility.RUNTIME_TYPES.STRING), TypeFacility.RUNTIME_TYPES.STRING, null)), null);
ProcedureExecution pe = fef.createProcedureExecution(call, null, null, fc);
pe.execute();
int count = 0;
while (true) {
if (pe.next() == null) {
break;
}
count++;
}
assertEquals(2, count);