mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-13 15:52:01 +07:00
Use assertTrue instead of assert
GitOrigin-RevId: 83fdb15a53686fad4175a525032dfea14cb116e9
This commit is contained in:
committed by
intellij-monorepo-bot
parent
75e4d4852a
commit
9a2d6e2607
@@ -36,8 +36,7 @@ import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Provides 3 streams of output named system, stdout and stderr,
|
||||
@@ -156,7 +155,7 @@ public class OutputChecker {
|
||||
String actual = preprocessBuffer(buildOutputString(), sortClassPath);
|
||||
|
||||
File outsDir = new File(myAppPath.produce(), "outs");
|
||||
assert outsDir.exists() || outsDir.mkdirs() : outsDir;
|
||||
assertTrue(outsDir.toString(), outsDir.exists() || outsDir.mkdirs());
|
||||
|
||||
File outFile = getOutFile(outsDir, jdk, null, "");
|
||||
if (!outFile.exists()) {
|
||||
|
||||
@@ -58,6 +58,7 @@ import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static com.intellij.configurationStore.StoreUtilKt.getPersistentStateComponentStorageLocation;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public final class CompilerTester {
|
||||
private static final Logger LOG = Logger.getInstance(CompilerTester.class);
|
||||
@@ -142,7 +143,7 @@ public final class CompilerTester {
|
||||
@Nullable
|
||||
public File findClassFile(String className, Module module) {
|
||||
VirtualFile out = ModuleRootManager.getInstance(module).getModuleExtension(CompilerModuleExtension.class).getCompilerOutputPath();
|
||||
assert out != null;
|
||||
assertNotNull(out);
|
||||
File cls = new File(out.getPath(), className.replace('.', '/') + ".class");
|
||||
return cls.exists() ? cls : null;
|
||||
}
|
||||
@@ -151,7 +152,7 @@ public final class CompilerTester {
|
||||
WriteAction.runAndWait(() -> {
|
||||
file.setBinaryContent(file.contentsToByteArray(), -1, file.getTimeStamp() + 1);
|
||||
File ioFile = VfsUtilCore.virtualToIoFile(file);
|
||||
assert ioFile.setLastModified(ioFile.lastModified() - 100000);
|
||||
assertTrue(ioFile.setLastModified(ioFile.lastModified() - 100000));
|
||||
file.refresh(false, false);
|
||||
});
|
||||
}
|
||||
@@ -197,11 +198,11 @@ public final class CompilerTester {
|
||||
CompilerTestUtil.saveApplicationSettings();
|
||||
CompilerTests.saveWorkspaceModelCaches(getProject());
|
||||
EdtTestUtil.runInEdtAndWait(() -> {
|
||||
// for now directory based project is used for external storage
|
||||
// for now, a directory-based project is used for external storage
|
||||
if (!ProjectKt.isDirectoryBased(myProject)) {
|
||||
for (Module module : myModules) {
|
||||
Path ioFile = module.getModuleNioFile();
|
||||
assert Files.exists(ioFile) : "File does not exist: " + ioFile;
|
||||
assertTrue("File does not exist: " + ioFile, Files.exists(ioFile));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,9 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public abstract class JavaModuleFixtureBuilderImpl<T extends ModuleFixture> extends ModuleFixtureBuilderImpl<T> implements JavaModuleFixtureBuilder<T> {
|
||||
private final List<Lib> myLibraries = new ArrayList<>();
|
||||
private final List<MavenLib> myMavenLibraries = new ArrayList<>();
|
||||
@@ -210,18 +213,18 @@ public abstract class JavaModuleFixtureBuilderImpl<T extends ModuleFixture> exte
|
||||
if (myOutputPath != null) {
|
||||
final File pathFile = new File(myOutputPath);
|
||||
if (!pathFile.mkdirs()) {
|
||||
assert pathFile.exists() : "unable to create: " + myOutputPath;
|
||||
assertTrue("unable to create: " + myOutputPath, pathFile.exists());
|
||||
}
|
||||
final VirtualFile virtualFile = LocalFileSystem.getInstance().refreshAndFindFileByPath(myOutputPath);
|
||||
assert virtualFile != null : "cannot find output path: " + myOutputPath;
|
||||
assertNotNull("cannot find output path: " + myOutputPath, virtualFile);
|
||||
rootModel.getModuleExtension(CompilerModuleExtension.class).setCompilerOutputPath(virtualFile);
|
||||
rootModel.getModuleExtension(CompilerModuleExtension.class).inheritCompilerOutputPath(false);
|
||||
rootModel.getModuleExtension(CompilerModuleExtension.class).setExcludeOutput(false);
|
||||
}
|
||||
if (myTestOutputPath != null) {
|
||||
assert new File(myTestOutputPath).mkdirs() : myTestOutputPath;
|
||||
assertTrue(myTestOutputPath, new File(myTestOutputPath).mkdirs());
|
||||
final VirtualFile virtualFile = LocalFileSystem.getInstance().refreshAndFindFileByPath(myTestOutputPath);
|
||||
assert virtualFile != null : "cannot find test output path: " + myTestOutputPath;
|
||||
assertNotNull("cannot find test output path: " + myTestOutputPath, virtualFile);
|
||||
rootModel.getModuleExtension(CompilerModuleExtension.class).setCompilerOutputPathForTests(virtualFile);
|
||||
rootModel.getModuleExtension(CompilerModuleExtension.class).inheritCompilerOutputPath(false);
|
||||
rootModel.getModuleExtension(CompilerModuleExtension.class).setExcludeOutput(false);
|
||||
|
||||
@@ -51,8 +51,8 @@ public class ShFileCompletionTest extends BasePlatformTestCase {
|
||||
|
||||
public void testSimple() throws Exception {
|
||||
if (SystemInfo.isWindows) return; // "Tests shouldn't run on Windows OS",
|
||||
assert new File(myTempDirectory, FIRST_FILE_NAME).createNewFile();
|
||||
assert new File(myTempDirectory, SECOND_FILE_NAME).createNewFile();
|
||||
assertTrue(new File(myTempDirectory, FIRST_FILE_NAME).createNewFile());
|
||||
assertTrue(new File(myTempDirectory, SECOND_FILE_NAME).createNewFile());
|
||||
|
||||
String path = myTempDirectory.getCanonicalPath();
|
||||
myFixture.configureByText("a.sh", path + "/<caret>");
|
||||
@@ -62,9 +62,9 @@ public class ShFileCompletionTest extends BasePlatformTestCase {
|
||||
public void testFolderCompletion() throws Exception {
|
||||
if (SystemInfo.isWindows) return; // "Tests shouldn't run on Windows OS",
|
||||
File folder = new File(myTempDirectory, FOLDER_NAME);
|
||||
assert folder.mkdir();
|
||||
assert new File(folder, FIRST_FILE_NAME).createNewFile();
|
||||
assert new File(folder, SECOND_FILE_NAME).createNewFile();
|
||||
assertTrue(folder.mkdir());
|
||||
assertTrue(new File(folder, FIRST_FILE_NAME).createNewFile());
|
||||
assertTrue(new File(folder, SECOND_FILE_NAME).createNewFile());
|
||||
|
||||
String path = myTempDirectory.getCanonicalPath();
|
||||
myFixture.configureByText("a.sh", path + "/<caret>");
|
||||
@@ -77,7 +77,7 @@ public class ShFileCompletionTest extends BasePlatformTestCase {
|
||||
public void testFileNameEncoding() throws Exception {
|
||||
if (SystemInfo.isWindows) return; // "Tests shouldn't run on Windows OS",
|
||||
String folderName = " '\"#$=,[]!<>|;{}()*?^&`";
|
||||
assert new File(myTempDirectory, folderName).mkdir();
|
||||
assertTrue(new File(myTempDirectory, folderName).mkdir());
|
||||
|
||||
String path = myTempDirectory.getCanonicalPath();
|
||||
myFixture.configureByText("a.sh", path + "/<caret>");
|
||||
@@ -123,8 +123,8 @@ public class ShFileCompletionTest extends BasePlatformTestCase {
|
||||
|
||||
public void testCompletionWithPrefixMatch() throws IOException {
|
||||
if (SystemInfo.isWindows) return; // "Tests shouldn't run on Windows OS",
|
||||
assert new File(myTempDirectory, FIRST_FILE_NAME).createNewFile();
|
||||
assert new File(myTempDirectory, SECOND_FILE_NAME).createNewFile();
|
||||
assertTrue(new File(myTempDirectory, FIRST_FILE_NAME).createNewFile());
|
||||
assertTrue(new File(myTempDirectory, SECOND_FILE_NAME).createNewFile());
|
||||
|
||||
String path = myTempDirectory.getCanonicalPath();
|
||||
myFixture.configureByText("a.sh", path + "/<caret>");
|
||||
@@ -142,9 +142,9 @@ public class ShFileCompletionTest extends BasePlatformTestCase {
|
||||
|
||||
public void testReplacement() throws Exception {
|
||||
if (SystemInfo.isWindows) return; // "Tests shouldn't run on Windows OS",
|
||||
assert new File(myTempDirectory, FOLDER_NAME).mkdir();
|
||||
assert new File(myTempDirectory, FIRST_FILE_NAME).createNewFile();
|
||||
assert new File(myTempDirectory, SECOND_FILE_NAME).createNewFile();
|
||||
assertTrue(new File(myTempDirectory, FOLDER_NAME).mkdir());
|
||||
assertTrue(new File(myTempDirectory, FIRST_FILE_NAME).createNewFile());
|
||||
assertTrue(new File(myTempDirectory, SECOND_FILE_NAME).createNewFile());
|
||||
|
||||
String path = myTempDirectory.getCanonicalPath();
|
||||
myFixture.configureByText("a.sh", path + "/<caret>");
|
||||
|
||||
Reference in New Issue
Block a user