@Test public void testFailures() throws IOException { File fail = copyResourceTo("/failure/duplicate_field_id.thrift", temp.getRoot()); TypeLoader loader = new TypeLoader(ImmutableList.of()); File folder = temp.newFolder("boo"); try { loader.load(folder); fail("no exception"); } catch (IllegalArgumentException e) { assertThat(e.getMessage(), is("Unable to load thrift program: " + folder.getCanonicalFile() + " is not a file.")); } File noFile = new File(temp.getRoot(), "boo"); try { loader.load(noFile); fail("no exception"); } catch (IllegalArgumentException e) { assertThat(e.getMessage(), is("Unable to load thrift program: " + noFile.getCanonicalFile() + " is not a file.")); } try { loader.load(fail); fail("no exception"); } catch (ParseException e) { assertThat(e.getMessage(), is("Field id 1 already exists in T")); assertThat(e.getFile(), is(fail.getName())); } }
public ProgramTypeRegistry load(File file) throws IOException { return loadInternal(file, new ArrayList<>()); }
TypeLoader { public ProgramTypeRegistry load(File file) throws IOException { return loadInternal(file, new ArrayList<>()); } }
TypeLoader { public ProgramTypeRegistry load(File file) throws IOException { return loadInternal(file, new ArrayList<>()); } TypeLoader(Collection<File> includes);  TypeLoader(Collection<File> includes, ProgramParser parser); private  TypeLoader(Collection<File> includes, ProgramParser parser, ProgramRegistry registry); protected  TypeLoader(Collection<File> includes, ProgramParser parser, ProgramRegistry registry, ProgramConverter converter); }
TypeLoader { public ProgramTypeRegistry load(File file) throws IOException { return loadInternal(file, new ArrayList<>()); } TypeLoader(Collection<File> includes);  TypeLoader(Collection<File> includes, ProgramParser parser); private  TypeLoader(Collection<File> includes, ProgramParser parser, ProgramRegistry registry); protected  TypeLoader(Collection<File> includes, ProgramParser parser, ProgramRegistry registry, ProgramConverter converter); Collection<ProgramType> loadedPrograms(); ProgramTypeRegistry load(File file); ProgramRegistry getProgramRegistry(); }
TypeLoader { public ProgramTypeRegistry load(File file) throws IOException { return loadInternal(file, new ArrayList<>()); } TypeLoader(Collection<File> includes);  TypeLoader(Collection<File> includes, ProgramParser parser); private  TypeLoader(Collection<File> includes, ProgramParser parser, ProgramRegistry registry); protected  TypeLoader(Collection<File> includes, ProgramParser parser, ProgramRegistry registry, ProgramConverter converter); Collection<ProgramType> loadedPrograms(); ProgramTypeRegistry load(File file); ProgramRegistry getProgramRegistry();  }