private ContentEntry getContentRoot(String moduleName) { ContentEntry[] ee = getContentRoots(moduleName); List<String> roots = new ArrayList<String>(); for (ContentEntry e : ee) { roots.add(e.getUrl()); } String message = "Several content roots found: [" + StringUtil.join(roots, ", ") + "]"; assertEquals(message, 1, ee.length); return ee[0]; }
protected void assertContentRoots(String moduleName, String... expectedRoots) { List<String> actual = new ArrayList<String>(); for (ContentEntry e : getContentRoots(moduleName)) { actual.add(e.getUrl()); } for (int i = 0; i < expectedRoots.length; i++) { expectedRoots[i] = VfsUtil.pathToUrl(expectedRoots[i]); } assertUnorderedPathsAreEqual(actual, Arrays.asList(expectedRoots)); }
private static void doAssertContentFolders( ContentEntry e, final List<? extends ContentFolder> folders, String... expected) { List<String> actual = new ArrayList<String>(); for (ContentFolder f : folders) { String rootUrl = e.getUrl(); String folderUrl = f.getUrl(); if (folderUrl.startsWith(rootUrl)) { int length = rootUrl.length() + 1; folderUrl = folderUrl.substring(Math.min(length, folderUrl.length())); } actual.add(folderUrl); } assertOrderedElementsAreEqual(actual, Arrays.asList(expected)); }
private ContentEntry getContentRoot(String moduleName, String path) { for (ContentEntry e : getContentRoots(moduleName)) { if (e.getUrl().equals(VfsUtil.pathToUrl(path))) return e; } throw new AssertionError("content root not found"); }