JavaSourceFetchExtension extends AbstractFetchException { public static String fetch( String location, String method ) throws Exception { File fetchFile = checkCache( location ); if ( fetchFile == null ) { URL url = new URL(location); fetchFile = cache(location,url.openStream()); } if ( method == null || "".equals(method) ) { CompilationUnit cu = JavaParser.parse(new FileInputStream(fetchFile)); return cu.toString(); } else { CompilationUnit cu = JavaParser.parse(new FileInputStream(fetchFile)); MethodVisitor mv = new MethodVisitor(method); mv.visit(cu,null); return mv.source; } }  static String fetch( String location, String method );  }
@Test public void testSourceFetch() throws Exception { JavaSourceFetchExtension srcFetch = new JavaSourceFetchExtension(); String src = srcFetch.fetch("https: Assert.assertNotNull(src); }