TestFramework: cleanup, copyrights, use org.junit.Assert

This commit is contained in:
Yann Cébron
2014-04-09 09:22:47 +02:00
parent c19f73d239
commit 195ca9b2a1
19 changed files with 96 additions and 50 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,7 +32,7 @@ import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.util.text.StringUtilRt;
import com.intellij.openapi.vfs.CharsetToolkit;
import com.intellij.util.containers.HashMap;
import junit.framework.Assert;
import org.junit.Assert;
import java.io.File;
import java.io.FileOutputStream;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
package com.intellij.find;
import com.intellij.testFramework.LightVirtualFile;
import junit.framework.Assert;
import org.junit.Assert;
public class FindManagerTestUtils {
static void runFindInCommentsAndLiterals(FindManager findManager, FindModel findModel, String text) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,13 +27,14 @@ import com.intellij.testFramework.fixtures.IdeaProjectTestFixture;
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture;
import com.intellij.testFramework.fixtures.TempDirTestFixture;
import com.intellij.util.ui.UIUtil;
import junit.framework.Assert;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.junit.Assert;
/**
* @author yole
*/
@SuppressWarnings("TestOnlyProblems")
public class JavaCodeInsightTestFixtureImpl extends CodeInsightTestFixtureImpl implements JavaCodeInsightTestFixture {
public JavaCodeInsightTestFixtureImpl(IdeaProjectTestFixture projectFixture, TempDirTestFixture tempDirFixture) {
super(projectFixture, tempDirFixture);
@@ -1,6 +1,21 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.conversion;
import junit.framework.Assert;
import org.junit.Assert;
import java.io.File;
import java.util.List;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,7 +24,7 @@ import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiElement;
import com.intellij.testFramework.ProjectViewTestUtil;
import junit.framework.Assert;
import org.junit.Assert;
public class TestProjectTreeStructure extends AbstractProjectTreeStructure implements Disposable {
protected boolean myShowMembers = false;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,7 +21,7 @@ import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.project.impl.ProjectManagerImpl;
import com.intellij.openapi.vfs.encoding.EncodingManager;
import com.intellij.util.containers.hash.LinkedHashMap;
import junit.framework.Assert;
import org.junit.Assert;
import java.util.List;
import java.util.Map;
@@ -34,7 +34,7 @@ import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.tree.IElementType;
import junit.framework.Assert;
import org.junit.Assert;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -46,9 +46,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
/**
* User: Maxim.Mossienko
* Date: 15.03.2010
* Time: 21:00:49
* @author Maxim.Mossienko
*/
public class EditorTestUtil {
public static final String CARET_TAG = "<caret>";
@@ -13,10 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @author cdr
*/
package com.intellij.testFramework;
import com.intellij.codeHighlighting.Pass;
@@ -51,7 +47,7 @@ import com.intellij.util.NullableFunction;
import com.intellij.util.containers.ContainerUtil;
import gnu.trove.THashMap;
import gnu.trove.THashSet;
import junit.framework.Assert;
import org.junit.Assert;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -63,6 +59,9 @@ import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* @author cdr
*/
public class ExpectedHighlightingData {
private static final Logger LOG = Logger.getInstance("#com.intellij.testFramework.ExpectedHighlightingData");
@@ -99,7 +98,7 @@ public class ExpectedHighlightingData {
public void init() {
new WriteCommandAction(null){
@Override
protected void run(Result result) throws Throwable {
protected void run(@NotNull Result result) throws Throwable {
extractExpectedLineMarkerSet(myDocument);
extractExpectedHighlightsSet(myDocument);
refreshLineMarkers();
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,7 +26,7 @@ import com.intellij.ui.treeStructure.Tree;
import com.intellij.ui.treeStructure.filtered.FilteringTreeBuilder;
import com.intellij.ui.treeStructure.filtered.FilteringTreeStructure;
import com.intellij.util.ui.tree.TreeUtil;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Before;
import javax.swing.tree.TreePath;
@@ -120,7 +120,7 @@ public abstract class FileStructureTestBase extends CodeInsightFixtureTestCase {
}
protected FilteringTreeStructure.FilteringNode getRootNode() {
return (FilteringTreeStructure.FilteringNode)getStructure().getRootElement();
return getStructure().getRootElement();
}
protected void updateRecursively(final FilteringTreeStructure.FilteringNode node) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,7 +23,7 @@ import com.intellij.codeInspection.ex.InspectionToolWrapper;
import com.intellij.codeInspection.ui.InspectionToolPresentation;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.JDOMUtil;
import junit.framework.Assert;
import org.junit.Assert;
import org.jdom.Document;
import org.jdom.Element;
import org.jetbrains.annotations.NotNull;
@@ -471,7 +471,7 @@ public class PlatformTestUtil {
public void assertTiming() {
assert expectedMs != 0 : "Must call .expect() before run test";
if (COVERAGE_ENABLED_BUILD) return;
Timings.getStatistics(); // warmup, measure
Timings.getStatistics(); // warm-up, measure
while (true) {
attempts--;
@@ -747,7 +747,7 @@ public class PlatformTestUtil {
public static void assertElementsEqual(final Element expected, final Element actual) throws IOException {
if (!JDOMUtil.areElementsEqual(expected, actual)) {
junit.framework.Assert.assertEquals(printElement(expected), printElement(actual));
assertEquals(printElement(expected), printElement(actual));
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,10 +24,10 @@ import com.intellij.openapi.ui.Queryable;
import com.intellij.openapi.util.MultiValuesMap;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiElement;
import com.intellij.psi.util.PsiUtilBase;
import com.intellij.psi.util.PsiUtilCore;
import com.intellij.util.Function;
import junit.framework.Assert;
import org.jetbrains.annotations.Nullable;
import org.junit.Assert;
import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
@@ -40,7 +40,7 @@ public class ProjectViewTestUtil {
public static VirtualFile[] getFiles(AbstractTreeNode kid, Function<AbstractTreeNode, VirtualFile[]> converterFunction) {
if (kid instanceof BasePsiNode) {
Object value = kid.getValue();
VirtualFile virtualFile = PsiUtilBase.getVirtualFile((PsiElement)value);
VirtualFile virtualFile = PsiUtilCore.getVirtualFile((PsiElement)value);
return new VirtualFile[]{virtualFile};
}
if (converterFunction != null) {
@@ -39,13 +39,13 @@ import com.intellij.psi.impl.DebugUtil;
import com.intellij.util.Consumer;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.containers.ContainerUtil;
import junit.framework.Assert;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.model.JpsElement;
import org.jetbrains.jps.model.java.JavaSourceRootType;
import org.jetbrains.jps.model.module.JpsModuleSourceRootType;
import org.junit.Assert;
import java.io.File;
import java.util.ArrayList;
@@ -350,7 +350,7 @@ public class PsiTestUtil {
public static Module addModule(final Project project, final ModuleType type, final String name, final VirtualFile root) {
return new WriteCommandAction<Module>(project) {
@Override
protected void run(Result<Module> result) throws Throwable {
protected void run(@NotNull Result<Module> result) throws Throwable {
String moduleName;
ModifiableModuleModel moduleModel = ModuleManager.getInstance(project).getModifiableModel();
try {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@ package com.intellij.testFramework;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.project.impl.ProjectManagerImpl;
import gnu.trove.THashSet;
import junit.framework.Assert;
import org.junit.Assert;
import java.util.Collection;
import java.util.Collections;
@@ -46,12 +46,16 @@ import com.intellij.util.*;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.ui.UIUtil;
import gnu.trove.THashSet;
import junit.framework.*;
import junit.framework.AssertionFailedError;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.intellij.lang.annotations.RegExp;
import org.jdom.Element;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.junit.Assert;
import java.awt.*;
import java.io.File;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,7 +23,7 @@ import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.PathUtil;
import com.intellij.util.text.StringTokenizer;
import junit.framework.Assert;
import org.junit.Assert;
import java.io.File;
import java.io.IOException;
@@ -50,9 +50,9 @@ public class VfsTestUtil {
}
private static VirtualFile createFileOrDir(final VirtualFile root,
final String relativePath,
final String text,
final boolean dir) {
final String relativePath,
final String text,
final boolean dir) {
try {
AccessToken token = WriteAction.start();
try {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,18 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* @author max
*/
package com.intellij.testFramework.fixtures.impl;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.util.Disposer;
import com.intellij.testFramework.UsefulTestCase;
import com.intellij.testFramework.fixtures.IdeaTestFixture;
import junit.framework.Assert;
import org.junit.Assert;
/*
* @author max
*/
public class BaseFixture implements IdeaTestFixture {
private boolean myDisposed;
private boolean myInitialized;
@@ -1,8 +1,23 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.util.io;
import com.intellij.openapi.util.io.FileUtil;
import junit.framework.Assert;
import org.jetbrains.annotations.Nullable;
import org.junit.Assert;
import java.io.File;
import java.io.IOException;
@@ -1,6 +1,21 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.util.xml;
import junit.framework.Assert;
import org.junit.Assert;
import java.util.ArrayList;
import java.util.List;