@Test
  public void testExecuteSuccess() throws Exception {
    entry.arguments = new String[] {existingFile1, existingFile2};

    Result res = entry.execute(new Result(), 0);

    assertTrue("Entry failed", res.getResult());
  }
  @Test
  public void testExecuteFail() throws Exception {
    entry.arguments =
        new String[] {existingFile1, existingFile2, "nonExistingFile1.ext", "nonExistingFile2.ext"};

    Result res = entry.execute(new Result(), 0);

    assertFalse("Entry should fail", res.getResult());
  }
  @Test
  public void testExecuteWithException() throws Exception {
    entry.arguments = new String[] {null};

    Result res = entry.execute(new Result(), 0);

    assertFalse("Entry should fail", res.getResult());
    assertEquals(
        "File with wrong name was specified. One error should be reported", 1, res.getNrErrors());
  }
  @Test
  public void testSetNrErrorsNewBehaviorFalseResult() throws Exception {
    // this tests fix for PDI-10270
    entry.arguments = new String[] {"nonExistingFile.ext"};

    Result res = entry.execute(new Result(), 0);

    assertFalse("Entry should fail", res.getResult());
    assertEquals(
        "Files not found. Result is false. But... No of errors should be zero",
        0,
        res.getNrErrors());
  }
  @Test
  public void testSetNrErrorsOldBehaviorFalseResult() throws Exception {
    // this tests backward compatibility settings for PDI-10270
    entry.arguments = new String[] {"nonExistingFile1.ext", "nonExistingFile2.ext"};

    entry.setVariable(Const.KETTLE_COMPATIBILITY_SET_ERROR_ON_SPECIFIC_JOB_ENTRIES, "Y");

    Result res = entry.execute(new Result(), 0);

    assertFalse("Entry should fail", res.getResult());
    assertEquals(
        "Files not found. Result is false. And... Number of errors should be the same as number of not found files",
        entry.arguments.length,
        res.getNrErrors());
  }
  @Before
  public void setUp() throws Exception {
    job = new Job(null, new JobMeta());
    entry = new JobEntryFilesExist();

    job.getJobMeta().addJobEntry(new JobEntryCopy(entry));
    entry.setParentJob(job);

    job.setStopped(false);

    File f = File.createTempFile("existingFile", "ext");
    f.deleteOnExit();
    existingFile1 = f.getPath();

    f = File.createTempFile("existingFile", "ext");
    f.deleteOnExit();
    existingFile2 = f.getPath();
  }