NdkContentEntriesSetup extends ContentEntriesSetup { @Override public void execute(@NotNull List<ContentEntry> contentEntries) { Collection<File> sourceFolders = myAndroidModel.getSelectedVariant().getSourceFolders(); if (!sourceFolders.isEmpty()) { for (File path : sourceFolders) { addSourceFolder(path, contentEntries, SOURCE, false); } } addOrphans(); excludeFromContentEntries(contentEntries, ".externalNativeBuild"); excludeFromContentEntries(contentEntries, ".cxx"); } NdkContentEntriesSetup(@NotNull NdkModuleModel ndkModuleModel, @NotNull ModifiableRootModel rootModel); @Override void execute(@NotNull List<ContentEntry> contentEntries);  }
@Test public void excludeExternalNativeBuild() { ContentEntry contentEntry = mock(ContentEntry.class); NdkVariant mockNdkVariant = mock(NdkVariant.class); when (mockNdkVariant.getSourceFolders()).thenReturn(Collections.emptyList()); when(myNdkModuleModel.getSelectedVariant()).thenReturn(mockNdkVariant); myNdkContentEntriesSetup.execute(Collections.singletonList(contentEntry)); File excludePath = new File(myNdkModuleModel.getRootDirPath(), ".externalNativeBuild"); verify(contentEntry).addExcludeFolder(pathToIdeaUrl(excludePath)); }
@Test public void cxx() { ContentEntry contentEntry = mock(ContentEntry.class); NdkVariant mockNdkVariant = mock(NdkVariant.class); when (mockNdkVariant.getSourceFolders()).thenReturn(Collections.emptyList()); when(myNdkModuleModel.getSelectedVariant()).thenReturn(mockNdkVariant); myNdkContentEntriesSetup.execute(Collections.singletonList(contentEntry)); File excludePath = new File(myNdkModuleModel.getRootDirPath(), ".cxx"); verify(contentEntry).addExcludeFolder(pathToIdeaUrl(excludePath)); }