Example #1
0
  /**
   * Tests configuration with a single input directory.
   *
   * @throws Exception
   */
  public void testSingleDir() throws Exception {
    JFlexMojo mojo = newMojo("single-dir-test");
    mojo.execute();

    File produced = getExpectedOutputFile(mojo);
    assertTrue("produced file is a file: " + produced, produced.isFile());
  }
Example #2
0
  /**
   * Tests configuration with a single input file.
   *
   * @throws Exception
   */
  public void testSingleFile() throws Exception {
    JFlexMojo mojo = newMojo("single-file-test");
    mojo.execute();

    File produced = getExpectedOutputFile(mojo);
    assertTrue("produced file is a file: " + produced, produced.isFile());

    long size = produced.length();
    /*
     * NOTE: The final file size also depends on the employed line
     * terminator. For this reason, the generated output will be longer on a
     * Windows platform ("\r\n") than on a Unix platform ("\n").
     */
    boolean correctSize = (size > 26624) && (size < 29696);
    assertTrue("size of produced file between 26k and 29k. Actual is " + size, correctSize);
  }