String () { URL url = TestUtil.class.getResource("/" + TestUtil.class.getName().replace('.', '/') + ".class"); if (url != null && url.getProtocol().equals("file")) { try { File file = new File(url.toURI().getPath()); while (file != null) { String[] children = file.list(); if (children != null && ArrayUtil.contains(".idea", children)) { if (ArrayUtil.contains("community", children)) { return file.getPath() + "/community"; } else { return file.getPath(); } } file = file.getParentFile(); } } catch (Exception e) { throw new Error(e); } } throw new IllegalStateException("Failed to find community home path"); }