Java Code Examples for com.intellij.mock.MockVirtualFile#setParent()
The following examples show how to use
com.intellij.mock.MockVirtualFile#setParent() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ORProjectManagerTest.java From reasonml-idea-plugin with MIT License | 6 votes |
@Test public void testFindBsConfigurationFiles_sortedByFileDepth() { String mockFileName = BsConstants.BS_CONFIG_FILENAME; MockVirtualFile mockBsConfigFileParent = new MockVirtualFile(mockFileName); MockVirtualFile mockBsConfigFile = new MockVirtualFile(mockFileName); MockVirtualFile mockBsConfigFileChild = new MockVirtualFile(mockFileName); // set up mock file hierarchy mockBsConfigFile.setParent(mockBsConfigFileParent); mockBsConfigFileChild.setParent(mockBsConfigFile); MockVirtualFile[] mocksUnsorted = { mockBsConfigFile, mockBsConfigFileChild, mockBsConfigFileParent }; MockVirtualFile[] mocksSorted = { mockBsConfigFileParent, mockBsConfigFile, mockBsConfigFileChild }; when(FilenameIndex.getVirtualFilesByName(mockProject, mockFileName, mockScope)) .thenReturn(Arrays.asList(mocksUnsorted)); LinkedHashSet<VirtualFile> bsConfigurationFiles = ORProjectManager.findBsConfigurationFiles(mockProject); assertMocksSorted(bsConfigurationFiles, mocksSorted); }
Example 2
Source File: ORProjectManagerTest.java From reasonml-idea-plugin with MIT License | 6 votes |
@Test public void testFindDuneConfigurationFiles_sortedByFileDepth() { String mockFileName = DuneConstants.DUNE_FILENAME; MockVirtualFile mockDuneFileParent = new MockVirtualFile(mockFileName); MockVirtualFile mockDuneFile = new MockVirtualFile(mockFileName); MockVirtualFile mockDuneFileChild = new MockVirtualFile(mockFileName); // set up mock file hierarchy mockDuneFile.setParent(mockDuneFileParent); mockDuneFileChild.setParent(mockDuneFile); MockVirtualFile[] mocksUnsorted = { mockDuneFile, mockDuneFileChild, mockDuneFileParent }; MockVirtualFile[] mocksSorted = { mockDuneFileParent, mockDuneFile, mockDuneFileChild }; when(FilenameIndex.getVirtualFilesByName(mockProject, mockFileName, mockScope)) .thenReturn(Arrays.asList(mocksUnsorted)); LinkedHashSet<VirtualFile> duneConfigurationFiles = ORProjectManager.findDuneConfigurationFiles(mockProject); assertMocksSorted(duneConfigurationFiles, mocksSorted); }
Example 3
Source File: ORProjectManagerTest.java From reasonml-idea-plugin with MIT License | 6 votes |
@Test public void testFindEsyConfigurationFiles_sortedByFileDepth() { String mockFileName = EsyConstants.ESY_CONFIG_FILENAME; MockVirtualFile mockEsyConfigFileParent = new MockVirtualFile(mockFileName); MockVirtualFile mockEsyConfigFile = new MockVirtualFile(mockFileName); MockVirtualFile mockEsyConfigFileChild = new MockVirtualFile(mockFileName); // set up mock file hierarchy mockEsyConfigFile.setParent(mockEsyConfigFileParent); mockEsyConfigFileChild.setParent(mockEsyConfigFile); MockVirtualFile[] mocksUnsorted = { mockEsyConfigFile, mockEsyConfigFileChild, mockEsyConfigFileParent }; MockVirtualFile[] mocksSorted = { mockEsyConfigFileParent, mockEsyConfigFile, mockEsyConfigFileChild }; when(FilenameIndex.getVirtualFilesByName(mockProject, mockFileName, mockScope)) .thenReturn(Arrays.asList(mocksUnsorted)); when(EsyPackageJson.isEsyPackageJson(any())).thenReturn(true); LinkedHashSet<VirtualFile> esyConfigurationFiles = ORProjectManager.findEsyConfigurationFiles(mockProject); assertMocksSorted(esyConfigurationFiles, mocksSorted); }