Skeleton { public static void readSkelFile(File skeletonFile) { if (skeletonFile == null) throw new IllegalArgumentException("Skeleton file must not be null"); if (!skeletonFile.isFile() || !skeletonFile.canRead()) { Out.error(ErrorMessages.CANNOT_READ_SKEL, skeletonFile.toString()); throw new GeneratorException(); } Out.println(ErrorMessages.READING_SKEL, skeletonFile.toString()); try (BufferedReader reader = Files.newBufferedReader(Paths.get(skeletonFile.toString()), UTF_8)) { readSkel(reader); } catch (IOException e) { Out.error(ErrorMessages.SKEL_IO_ERROR); throw new GeneratorException(e); } } Skeleton(PrintWriter out); void emitNext(); static void makePrivate(); static void readSkelFile(File skeletonFile); static void readSkel(BufferedReader reader); static String replace(String a, String b, String c); static void readDefault(); static String[] line; }
@Test public void readSkelFile_maven() { assumeTrue(!TestFileUtils.BAZEL_RUNFILES); File skeletonFile = new File("src/main/jflex/skeleton.nested"); Skeleton.readSkelFile(skeletonFile); checkDefaultSkeleton(); }
@Test public void readSkelFile_bazel() throws FileNotFoundException { assumeTrue(TestFileUtils.BAZEL_RUNFILES); File skeletonFile = TestFileUtils.open(" Skeleton.readSkelFile(skeletonFile); checkDefaultSkeleton(); }