Implemented optional adding library sources in AbstractLibrariesTest.setUp()

This commit is contained in:
Evgeny Gerashchenko
2012-03-23 20:20:20 +04:00
parent a314fc929e
commit 0aee30f92f
2 changed files with 13 additions and 1 deletions
@@ -37,6 +37,8 @@ public abstract class AbstractLibrariesTest extends PlatformTestCase {
protected static final String TEST_DATA_PATH = PluginTestCaseBase.getTestDataPathBase() + "/libraries"; protected static final String TEST_DATA_PATH = PluginTestCaseBase.getTestDataPathBase() + "/libraries";
protected VirtualFile myLibraryDir; protected VirtualFile myLibraryDir;
protected abstract boolean isWithSources();
@Override @Override
protected void setUp() throws Exception { protected void setUp() throws Exception {
super.setUp(); super.setUp();
@@ -53,6 +55,11 @@ public abstract class AbstractLibrariesTest extends PlatformTestCase {
Library.ModifiableModel libraryModel = moduleModel.getModuleLibraryTable().getModifiableModel().createLibrary("myKotlinLib").getModifiableModel(); Library.ModifiableModel libraryModel = moduleModel.getModuleLibraryTable().getModifiableModel().createLibrary("myKotlinLib").getModifiableModel();
libraryModel.addRoot(myLibraryDir, OrderRootType.CLASSES); libraryModel.addRoot(myLibraryDir, OrderRootType.CLASSES);
if (isWithSources()) {
VirtualFile sourceDir = LocalFileSystem.getInstance().findFileByPath(TEST_DATA_PATH + "/library");
assert sourceDir != null;
libraryModel.addRoot(sourceDir, OrderRootType.SOURCES);
}
libraryModel.commit(); libraryModel.commit();
moduleModel.commit(); moduleModel.commit();
@@ -1,5 +1,5 @@
/* /*
* Copyright 2000-2012 JetBrains s.r.o. * Copyright 2010-2012 JetBrains s.r.o.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -131,4 +131,9 @@ public class LibrariesWithoutSourcesTest extends AbstractLibrariesTest {
assertNotNull(classFile); assertNotNull(classFile);
return classFile; return classFile;
} }
@Override
protected boolean isWithSources() {
return false;
}
} }