mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
notnull
This commit is contained in:
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* 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.codeInsight.intention;
|
||||
|
||||
import com.intellij.codeInsight.intention.impl.CreateSubclassAction;
|
||||
@@ -6,6 +21,7 @@ import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiDirectory;
|
||||
import com.intellij.psi.search.ProjectScope;
|
||||
import com.intellij.refactoring.MultiFileTestCase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
@@ -47,6 +63,7 @@ public class CreateSubclassTest extends MultiFileTestCase {
|
||||
});
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestRoot() {
|
||||
return "/codeInsight/createSubclass/";
|
||||
|
||||
@@ -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.
|
||||
@@ -22,6 +22,7 @@ import com.intellij.psi.PsiElement;
|
||||
import com.intellij.refactoring.MultiFileTestCase;
|
||||
import com.intellij.refactoring.rename.RenameProcessor;
|
||||
import com.intellij.refactoring.rename.RenamePsiElementProcessor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* User: anna
|
||||
@@ -53,6 +54,7 @@ public class SPIRenameTest extends MultiFileTestCase {
|
||||
});
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestRoot() {
|
||||
return "/spi/";
|
||||
|
||||
@@ -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.
|
||||
@@ -29,6 +29,7 @@ import com.intellij.refactoring.MultiFileTestCase;
|
||||
import org.jdom.Document;
|
||||
import org.jdom.Element;
|
||||
import org.jdom.JDOMException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
@@ -43,6 +44,7 @@ public class Convertor34Test extends MultiFileTestCase {
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestRoot() {
|
||||
return "/moduleRootManager/convertor34/";
|
||||
|
||||
@@ -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.
|
||||
@@ -21,6 +21,7 @@ import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.refactoring.move.MoveHandler;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
@@ -28,6 +29,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
* @since Aug 31, 2010
|
||||
*/
|
||||
public class DndMoveTest extends CodeInsightTestCase {
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestRoot() {
|
||||
return "/refactoring/dndMove/";
|
||||
|
||||
@@ -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.
|
||||
@@ -36,6 +36,7 @@ import com.intellij.refactoring.encapsulateFields.FieldDescriptor;
|
||||
import com.intellij.refactoring.encapsulateFields.FieldDescriptorImpl;
|
||||
import com.intellij.refactoring.util.DocCommentPolicy;
|
||||
import junit.framework.Assert;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class EncapsulateFieldsTest extends MultiFileTestCase{
|
||||
public void testAlreadyExist() throws Exception {
|
||||
@@ -76,6 +77,7 @@ public class EncapsulateFieldsTest extends MultiFileTestCase{
|
||||
return JavaTestUtil.getJavaTestDataPath();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestRoot() {
|
||||
return "/refactoring/encapsulateFields/";
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* User: anna
|
||||
* Date: 20-Aug-2008
|
||||
@@ -17,6 +33,7 @@ import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.refactoring.extractclass.ExtractClassProcessor;
|
||||
import com.intellij.refactoring.util.classMembers.MemberInfo;
|
||||
import junit.framework.Assert;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -24,6 +41,7 @@ import java.util.Collections;
|
||||
import java.util.TreeSet;
|
||||
|
||||
public class ExtractClassTest extends MultiFileTestCase{
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestRoot() {
|
||||
return "/refactoring/extractClass/";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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.
|
||||
@@ -28,6 +28,7 @@ import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.refactoring.extractclass.ExtractClassProcessor;
|
||||
import com.intellij.refactoring.util.classMembers.MemberInfo;
|
||||
import junit.framework.Assert;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -36,6 +37,7 @@ import java.util.TreeSet;
|
||||
|
||||
public class ExtractEnumTest extends MultiFileTestCase {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestRoot() {
|
||||
return "/refactoring/extractEnum/";
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* 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.refactoring;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
@@ -8,6 +23,7 @@ import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.refactoring.inheritanceToDelegation.InheritanceToDelegationProcessor;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -21,6 +37,7 @@ public class InheritanceToDelegationTest extends MultiFileTestCase {
|
||||
return JavaTestUtil.getJavaTestDataPath();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestRoot() {
|
||||
return "/refactoring/inheritanceToDelegation/";
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* User: anna
|
||||
* Date: 20-Aug-2008
|
||||
@@ -10,8 +26,10 @@ import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.refactoring.inlineSuperClass.InlineSuperClassRefactoringProcessor;
|
||||
import com.intellij.refactoring.util.DocCommentPolicy;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class InlineSuperClassTest extends MultiFileTestCase {
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestRoot() {
|
||||
return "/refactoring/inlineSuperClass/";
|
||||
|
||||
@@ -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.
|
||||
@@ -30,8 +30,10 @@ import com.intellij.refactoring.introduceparameterobject.IntroduceParameterObjec
|
||||
import com.intellij.refactoring.util.VariableData;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.VisibilityUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class IntroduceParameterObjectTest extends MultiFileTestCase{
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestRoot() {
|
||||
return "/refactoring/introduceParameterObject/";
|
||||
|
||||
+3
-1
@@ -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.
|
||||
@@ -27,6 +27,7 @@ import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.refactoring.introduceVariable.IntroduceVariableBase;
|
||||
import com.intellij.testFramework.PlatformTestCase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author dsl
|
||||
@@ -39,6 +40,7 @@ public class IntroduceVariableMultifileTest extends MultiFileTestCase {
|
||||
LanguageLevelProjectExtension.getInstance(myJavaFacade.getProject()).setLanguageLevel(LanguageLevel.JDK_1_5);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestRoot() {
|
||||
return "/refactoring/introduceVariable/";
|
||||
|
||||
@@ -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.
|
||||
@@ -25,6 +25,7 @@ import com.intellij.refactoring.move.moveInner.MoveInnerDialog;
|
||||
import com.intellij.refactoring.move.moveInner.MoveInnerImpl;
|
||||
import com.intellij.refactoring.move.moveInner.MoveInnerProcessor;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
@@ -36,6 +37,7 @@ public class MoveInnerTest extends MultiFileTestCase {
|
||||
return JavaTestUtil.getJavaTestDataPath();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestRoot() {
|
||||
return "/refactoring/moveInner/";
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* 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.refactoring;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
@@ -13,6 +28,7 @@ import com.intellij.psi.search.ProjectScope;
|
||||
import com.intellij.refactoring.move.moveMembers.MockMoveMembersOptions;
|
||||
import com.intellij.refactoring.move.moveMembers.MoveMembersProcessor;
|
||||
import com.intellij.util.VisibilityUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashSet;
|
||||
@@ -171,6 +187,7 @@ public class MoveMembersTest extends MultiFileTestCase {
|
||||
doTest("Outer.Inner", "Outer", true, VisibilityUtil.ESCALATE_VISIBILITY, 0);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestRoot() {
|
||||
return "/refactoring/moveMembers/";
|
||||
|
||||
@@ -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.
|
||||
@@ -28,6 +28,7 @@ import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.refactoring.move.moveClassesOrPackages.MoveDirectoryWithClassesProcessor;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
import junit.framework.Assert;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
@@ -39,6 +40,7 @@ public class MovePackageAsDirectoryTest extends MultiFileTestCase {
|
||||
return JavaTestUtil.getJavaTestDataPath();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestRoot() {
|
||||
return "/refactoring/movePackageAsDir/";
|
||||
|
||||
@@ -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.
|
||||
@@ -28,6 +28,7 @@ import com.intellij.refactoring.move.moveClassesOrPackages.MoveClassesOrPackages
|
||||
import com.intellij.refactoring.move.moveClassesOrPackages.MultipleRootsMoveDestination;
|
||||
import com.intellij.JavaTestUtil;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author dsl
|
||||
@@ -39,6 +40,7 @@ public class MovePackageMultirootTest extends MultiFileTestCase {
|
||||
return JavaTestUtil.getJavaTestDataPath();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestRoot() {
|
||||
return "/refactoring/movePackageMultiroot/";
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* 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.refactoring;
|
||||
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
@@ -8,6 +23,7 @@ import com.intellij.psi.PsiPackage;
|
||||
import com.intellij.refactoring.move.moveClassesOrPackages.MoveClassesOrPackagesProcessor;
|
||||
import com.intellij.refactoring.move.moveClassesOrPackages.SingleSourceRootMoveDestination;
|
||||
import com.intellij.JavaTestUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class MovePackageTest extends MultiFileTestCase {
|
||||
|
||||
@@ -33,6 +49,7 @@ public class MovePackageTest extends MultiFileTestCase {
|
||||
doTest(new String[]{"a"}, "a.b");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestRoot() {
|
||||
return "/refactoring/movePackage/";
|
||||
|
||||
@@ -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.
|
||||
@@ -30,12 +30,14 @@ import com.intellij.refactoring.util.DocCommentPolicy;
|
||||
import com.intellij.refactoring.util.classMembers.InterfaceContainmentVerifier;
|
||||
import com.intellij.refactoring.util.classMembers.MemberInfo;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
|
||||
//pull first method from class a.A to class b.B
|
||||
public class PullUpMultifileTest extends MultiFileTestCase {
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestRoot() {
|
||||
return "/refactoring/pullUp/";
|
||||
|
||||
@@ -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.
|
||||
@@ -29,9 +29,11 @@ import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.refactoring.memberPushDown.PushDownProcessor;
|
||||
import com.intellij.refactoring.util.DocCommentPolicy;
|
||||
import com.intellij.refactoring.util.classMembers.MemberInfo;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
//push first method from class a.A to class b.B
|
||||
public class PushDownMultifileTest extends MultiFileTestCase {
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestRoot() {
|
||||
return "/refactoring/pushDown/";
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* User: anna
|
||||
* Date: 20-Aug-2008
|
||||
@@ -15,6 +31,7 @@ import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.refactoring.removemiddleman.DelegationUtils;
|
||||
import com.intellij.refactoring.removemiddleman.RemoveMiddlemanProcessor;
|
||||
import com.intellij.refactoring.util.classMembers.MemberInfo;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -26,6 +43,7 @@ public class RemoveMiddleManTest extends MultiFileTestCase{
|
||||
return JavaTestUtil.getJavaTestDataPath();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestRoot() {
|
||||
return "/refactoring/removemiddleman/";
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* 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.refactoring;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
@@ -10,6 +25,7 @@ import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.refactoring.rename.RenameProcessor;
|
||||
import com.intellij.refactoring.rename.naming.AutomaticRenamerFactory;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class RenameClassTest extends MultiFileTestCase {
|
||||
@Override
|
||||
@@ -101,6 +117,7 @@ public class RenameClassTest extends MultiFileTestCase {
|
||||
FileDocumentManager.getInstance().saveAllDocuments();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestRoot() {
|
||||
return "/refactoring/renameClass/";
|
||||
|
||||
@@ -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.
|
||||
@@ -23,6 +23,7 @@ import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiMethod;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.refactoring.rename.RenameProcessor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.junit.Assert;
|
||||
|
||||
/**
|
||||
@@ -34,6 +35,7 @@ public class RenameMethodMultiTest extends MultiFileTestCase {
|
||||
return JavaTestUtil.getJavaTestDataPath();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestRoot() {
|
||||
return "/refactoring/renameMethod/multi/";
|
||||
|
||||
+18
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* User: anna
|
||||
* Date: 06-May-2008
|
||||
@@ -14,6 +30,7 @@ import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.refactoring.replaceConstructorWithBuilder.ParameterData;
|
||||
import com.intellij.refactoring.replaceConstructorWithBuilder.ReplaceConstructorWithBuilderProcessor;
|
||||
import com.intellij.util.containers.HashMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
@@ -122,6 +139,7 @@ public class ReplaceConstructorWithBuilderTest extends MultiFileTestCase {
|
||||
}
|
||||
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestRoot() {
|
||||
return "/refactoring/replaceConstructorWithBuilder/";
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* 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.refactoring;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
@@ -11,6 +26,7 @@ import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.refactoring.safeDelete.SafeDeleteHandler;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jps.model.java.JavaSourceRootType;
|
||||
import org.jetbrains.jps.model.java.JpsJavaExtensionService;
|
||||
|
||||
@@ -20,6 +36,7 @@ public class SafeDeleteTest extends MultiFileTestCase {
|
||||
return JavaTestUtil.getJavaTestDataPath();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestRoot() {
|
||||
return "/refactoring/safeDelete/";
|
||||
|
||||
@@ -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.
|
||||
@@ -22,6 +22,7 @@ import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.refactoring.turnRefsToSuper.TurnRefsToSuperProcessor;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class TurnRefsToSuperTest extends MultiFileTestCase {
|
||||
public void testSuperClass() throws Exception { doTest("AClass", "ASuper", true); }
|
||||
@@ -73,6 +74,7 @@ public class TurnRefsToSuperTest extends MultiFileTestCase {
|
||||
}, true);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getTestRoot() {
|
||||
return "/refactoring/turnRefsToSuper/";
|
||||
|
||||
@@ -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,6 +27,7 @@ import com.intellij.refactoring.typeCook.deductive.builder.ReductionSystem;
|
||||
import com.intellij.refactoring.typeCook.deductive.builder.SystemBuilder;
|
||||
import com.intellij.refactoring.typeCook.deductive.resolver.Binding;
|
||||
import com.intellij.refactoring.typeCook.deductive.resolver.ResolverTree;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
@@ -47,6 +48,7 @@ public class TypeCookTest extends MultiFileTestCase {
|
||||
return JavaTestUtil.getJavaTestDataPath();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getTestRoot() {
|
||||
return "/refactoring/typeCook/";
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* User: anna
|
||||
* Date: 20-Aug-2008
|
||||
@@ -12,6 +28,7 @@ import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.refactoring.wrapreturnvalue.WrapReturnValueProcessor;
|
||||
import com.intellij.JavaTestUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class WrapReturnValueTest extends MultiFileTestCase{
|
||||
@Override
|
||||
@@ -19,6 +36,7 @@ public class WrapReturnValueTest extends MultiFileTestCase{
|
||||
return JavaTestUtil.getJavaTestDataPath();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestRoot() {
|
||||
return "/refactoring/wrapReturnValue/";
|
||||
|
||||
@@ -1,9 +1,25 @@
|
||||
/*
|
||||
* 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.refactoring.migration;
|
||||
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.refactoring.MultiFileTestCase;
|
||||
import com.intellij.JavaTestUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author dsl
|
||||
@@ -50,6 +66,7 @@ public class MigrationTest extends MultiFileTestCase {
|
||||
};
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestRoot() {
|
||||
return "/refactoring/migration/";
|
||||
|
||||
@@ -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.
|
||||
@@ -21,7 +21,6 @@ import com.intellij.injected.editor.EditorWindow;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.Result;
|
||||
import com.intellij.openapi.application.ex.PathManagerEx;
|
||||
import com.intellij.openapi.command.CommandProcessor;
|
||||
import com.intellij.openapi.command.WriteCommandAction;
|
||||
import com.intellij.openapi.command.undo.UndoManager;
|
||||
@@ -44,6 +43,7 @@ import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VfsUtilCore;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
@@ -68,6 +68,7 @@ import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Mike
|
||||
@@ -75,7 +76,7 @@ import java.util.List;
|
||||
public abstract class CodeInsightTestCase extends PsiTestCase {
|
||||
protected Editor myEditor;
|
||||
|
||||
protected Editor createEditor(VirtualFile file) {
|
||||
protected Editor createEditor(@NotNull VirtualFile file) {
|
||||
final FileEditorManager instance = FileEditorManager.getInstance(myProject);
|
||||
|
||||
if (file.getFileType().isBinary()) return null;
|
||||
@@ -112,7 +113,7 @@ public abstract class CodeInsightTestCase extends PsiTestCase {
|
||||
/**
|
||||
* @param files the first file will be loaded in editor
|
||||
*/
|
||||
protected VirtualFile configureByFiles(@Nullable String projectRoot,String... files) throws Exception {
|
||||
protected VirtualFile configureByFiles(@Nullable String projectRoot, @NotNull String... files) throws Exception {
|
||||
if (files.length == 0) return null;
|
||||
final VirtualFile[] vFiles = new VirtualFile[files.length];
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
@@ -128,7 +129,7 @@ public abstract class CodeInsightTestCase extends PsiTestCase {
|
||||
return configureByFiles(projectFile, vFiles);
|
||||
}
|
||||
|
||||
protected VirtualFile configureByFile(@NonNls String filePath, String projectRoot) throws Exception {
|
||||
protected VirtualFile configureByFile(@NonNls String filePath, @Nullable String projectRoot) throws Exception {
|
||||
String fullPath = getTestDataPath() + filePath;
|
||||
|
||||
final VirtualFile vFile = LocalFileSystem.getInstance().findFileByPath(fullPath.replace(File.separatorChar, '/'));
|
||||
@@ -139,11 +140,11 @@ public abstract class CodeInsightTestCase extends PsiTestCase {
|
||||
return configureByFile(vFile, projectFile);
|
||||
}
|
||||
|
||||
protected PsiFile configureByText(@NotNull FileType fileType, @NonNls final String text) {
|
||||
protected PsiFile configureByText(@NotNull FileType fileType, @NonNls @NotNull final String text) {
|
||||
return configureByText(fileType, text, null);
|
||||
}
|
||||
|
||||
protected PsiFile configureByText(@NotNull final FileType fileType, @NonNls final String text, @Nullable String _extension) {
|
||||
protected PsiFile configureByText(@NotNull final FileType fileType, @NonNls @NotNull String text, @Nullable String _extension) {
|
||||
try {
|
||||
final String extension = _extension == null ? fileType.getDefaultExtension():_extension;
|
||||
|
||||
@@ -177,16 +178,11 @@ public abstract class CodeInsightTestCase extends PsiTestCase {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return PathManagerEx.getTestDataPath();
|
||||
}
|
||||
|
||||
protected void configureByFile(final VirtualFile vFile) throws IOException {
|
||||
protected void configureByFile(@NotNull VirtualFile vFile) throws IOException {
|
||||
configureByFile(vFile, null);
|
||||
}
|
||||
|
||||
protected void configureByExistingFile(final VirtualFile virtualFile) {
|
||||
protected void configureByExistingFile(@NotNull final VirtualFile virtualFile) {
|
||||
myFile = null;
|
||||
myEditor = null;
|
||||
|
||||
@@ -216,7 +212,7 @@ public abstract class CodeInsightTestCase extends PsiTestCase {
|
||||
PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
|
||||
}
|
||||
|
||||
protected VirtualFile configureByFiles(@Nullable final File rawProjectRoot, final VirtualFile... vFiles) throws IOException {
|
||||
protected VirtualFile configureByFiles(@Nullable final File rawProjectRoot, @NotNull final VirtualFile... vFiles) throws IOException {
|
||||
myFile = null;
|
||||
myEditor = null;
|
||||
|
||||
@@ -235,7 +231,7 @@ public abstract class CodeInsightTestCase extends PsiTestCase {
|
||||
|
||||
// auxiliary files should be copied first
|
||||
VirtualFile[] reversed = ArrayUtil.reverseArray(vFiles);
|
||||
final LinkedHashMap<VirtualFile, EditorInfo> editorInfos;
|
||||
Map<VirtualFile, EditorInfo> editorInfos;
|
||||
if (rawProjectRoot != null) {
|
||||
final File projectRoot = rawProjectRoot.getCanonicalFile();
|
||||
FileUtil.copyDir(projectRoot, toDirIO);
|
||||
@@ -288,22 +284,26 @@ public abstract class CodeInsightTestCase extends PsiTestCase {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void doCommitModel(final ModifiableRootModel rootModel) {
|
||||
protected void doCommitModel(@NotNull ModifiableRootModel rootModel) {
|
||||
rootModel.commit();
|
||||
}
|
||||
|
||||
protected void sourceRootAdded(final VirtualFile dir) {
|
||||
}
|
||||
|
||||
protected LinkedHashMap<VirtualFile, EditorInfo> copyFilesFillingEditorInfos(String testDataFromDir,
|
||||
final VirtualFile toDir,
|
||||
final String... relativePaths) throws IOException {
|
||||
@NotNull
|
||||
protected Map<VirtualFile, EditorInfo> copyFilesFillingEditorInfos(@NotNull String testDataFromDir,
|
||||
@NotNull VirtualFile toDir,
|
||||
@NotNull String... relativePaths) throws IOException {
|
||||
if (!testDataFromDir.startsWith("/")) testDataFromDir = "/" + testDataFromDir;
|
||||
return copyFilesFillingEditorInfos(LocalFileSystem.getInstance().refreshAndFindFileByPath(getTestDataPath() + testDataFromDir), toDir, relativePaths);
|
||||
}
|
||||
|
||||
protected LinkedHashMap<VirtualFile, EditorInfo> copyFilesFillingEditorInfos(final VirtualFile fromDir, final VirtualFile toDir, final String... relativePaths) throws IOException {
|
||||
LinkedHashMap<VirtualFile, EditorInfo> editorInfos = new LinkedHashMap<VirtualFile, EditorInfo>();
|
||||
@NotNull
|
||||
protected Map<VirtualFile, EditorInfo> copyFilesFillingEditorInfos(@NotNull VirtualFile fromDir,
|
||||
@NotNull VirtualFile toDir,
|
||||
@NotNull String... relativePaths) throws IOException {
|
||||
Map<VirtualFile, EditorInfo> editorInfos = new LinkedHashMap<VirtualFile, EditorInfo>();
|
||||
|
||||
List<OutputStream> streamsToClose = new ArrayList<OutputStream>();
|
||||
|
||||
@@ -356,28 +356,30 @@ public abstract class CodeInsightTestCase extends PsiTestCase {
|
||||
}
|
||||
}*/
|
||||
|
||||
private EditorInfo copyContent(final VirtualFile from, final VirtualFile to, final List<OutputStream> streamsToClose) throws IOException {
|
||||
private EditorInfo copyContent(@NotNull VirtualFile from, @NotNull VirtualFile to, @NotNull List<OutputStream> streamsToClose) throws IOException {
|
||||
byte[] content = from.getFileType().isBinary() ? from.contentsToByteArray(): null;
|
||||
final String fileText = from.getFileType().isBinary() ? null : StringUtil.convertLineSeparators(VfsUtil.loadText(from));
|
||||
final String fileText = from.getFileType().isBinary() ? null : StringUtil.convertLineSeparators(VfsUtilCore.loadText(from));
|
||||
|
||||
EditorInfo editorInfo = fileText != null ? new EditorInfo(fileText) : null;
|
||||
String newFileText = fileText != null ? editorInfo.getNewFileText() : null;
|
||||
EditorInfo editorInfo = fileText == null ? null : new EditorInfo(fileText);
|
||||
String newFileText = fileText == null ? null : editorInfo.getNewFileText();
|
||||
doWrite(newFileText, to, content, streamsToClose);
|
||||
return editorInfo;
|
||||
}
|
||||
|
||||
protected final void setActiveEditor(Editor editor) {
|
||||
protected final void setActiveEditor(@NotNull Editor editor) {
|
||||
myEditor = editor;
|
||||
myFile = getPsiFile(editor.getDocument());
|
||||
}
|
||||
|
||||
protected List<Editor> openEditorsAndActivateLast(final LinkedHashMap<VirtualFile, EditorInfo> editorInfos) {
|
||||
@NotNull
|
||||
protected List<Editor> openEditorsAndActivateLast(@NotNull Map<VirtualFile, EditorInfo> editorInfos) {
|
||||
final List<Editor> list = openEditors(editorInfos);
|
||||
setActiveEditor(list.get(list.size() - 1));
|
||||
return list;
|
||||
}
|
||||
|
||||
protected final List<Editor> openEditors(final LinkedHashMap<VirtualFile, EditorInfo> editorInfos) {
|
||||
@NotNull
|
||||
protected final List<Editor> openEditors(@NotNull final Map<VirtualFile, EditorInfo> editorInfos) {
|
||||
return ContainerUtil.map(editorInfos.keySet(), new Function<VirtualFile, Editor>() {
|
||||
@Override
|
||||
public Editor fun(final VirtualFile newVFile) {
|
||||
@@ -396,14 +398,18 @@ public abstract class CodeInsightTestCase extends PsiTestCase {
|
||||
});
|
||||
}
|
||||
|
||||
private void doWrite(final String newFileText, final VirtualFile newVFile, final byte[] content, final List<OutputStream> streamsToClose) throws IOException {
|
||||
if (newFileText != null) {
|
||||
VfsUtil.saveText(newVFile, newFileText);
|
||||
} else {
|
||||
private void doWrite(final String newFileText,
|
||||
@NotNull VirtualFile newVFile,
|
||||
byte[] content,
|
||||
@NotNull List<OutputStream> streamsToClose) throws IOException {
|
||||
if (newFileText == null) {
|
||||
final OutputStream outputStream = newVFile.getOutputStream(this, -1, -1);
|
||||
outputStream.write(content);
|
||||
streamsToClose.add(outputStream);
|
||||
}
|
||||
else {
|
||||
VfsUtil.saveText(newVFile, newFileText);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isAddDirToContentRoot() {
|
||||
@@ -414,7 +420,7 @@ public abstract class CodeInsightTestCase extends PsiTestCase {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected VirtualFile configureByFile(final VirtualFile vFile, final File projectRoot) throws IOException {
|
||||
protected VirtualFile configureByFile(@NotNull VirtualFile vFile, File projectRoot) throws IOException {
|
||||
return configureByFiles(projectRoot, vFile);
|
||||
}
|
||||
|
||||
@@ -422,7 +428,7 @@ public abstract class CodeInsightTestCase extends PsiTestCase {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void setupCursorAndSelection(final Editor editor) {
|
||||
protected void setupCursorAndSelection(@NotNull final Editor editor) {
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -466,7 +472,7 @@ public abstract class CodeInsightTestCase extends PsiTestCase {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configure(String path, String dataName) throws Exception {
|
||||
protected void configure(@NotNull String path, String dataName) throws Exception {
|
||||
super.configure(path, dataName);
|
||||
|
||||
myEditor = createEditor(myFile.getVirtualFile());
|
||||
@@ -487,11 +493,11 @@ public abstract class CodeInsightTestCase extends PsiTestCase {
|
||||
myEditor.getSelectionModel().setSelection(selectionStart, selectionEnd);
|
||||
}
|
||||
|
||||
protected void checkResultByFile(@NonNls String filePath) throws Exception {
|
||||
protected void checkResultByFile(@NonNls @NotNull String filePath) throws Exception {
|
||||
checkResultByFile(filePath, false);
|
||||
}
|
||||
|
||||
protected void checkResultByFile(@NonNls final String filePath, final boolean stripTrailingSpaces) throws Exception {
|
||||
protected void checkResultByFile(@NonNls @NotNull final String filePath, final boolean stripTrailingSpaces) throws Exception {
|
||||
new WriteCommandAction<Document>(getProject()) {
|
||||
@Override
|
||||
protected void run(@NotNull Result<Document> result) throws Throwable {
|
||||
@@ -508,7 +514,7 @@ public abstract class CodeInsightTestCase extends PsiTestCase {
|
||||
assertNotNull("Cannot find file " + fullPath, vFile);
|
||||
String ft = null;
|
||||
try {
|
||||
ft = VfsUtil.loadText(vFile);
|
||||
ft = VfsUtilCore.loadText(vFile);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
@@ -626,7 +632,7 @@ public abstract class CodeInsightTestCase extends PsiTestCase {
|
||||
return CommonDataKeys.EDITOR.is(dataId) ? myEditor : super.getData(dataId);
|
||||
}
|
||||
|
||||
protected VirtualFile getVirtualFile(@NonNls String filePath) {
|
||||
protected VirtualFile getVirtualFile(@NonNls @NotNull String filePath) {
|
||||
String fullPath = getTestDataPath() + filePath;
|
||||
|
||||
final VirtualFile vFile = LocalFileSystem.getInstance().findFileByPath(fullPath.replace(File.separatorChar, '/'));
|
||||
@@ -634,6 +640,7 @@ public abstract class CodeInsightTestCase extends PsiTestCase {
|
||||
return vFile;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected String getTestRoot(){
|
||||
return FileUtil.toSystemIndependentName(getTestDataPath());
|
||||
}
|
||||
@@ -673,7 +680,7 @@ public abstract class CodeInsightTestCase extends PsiTestCase {
|
||||
action.execute(getEditor(), DataManager.getInstance().getDataContext());
|
||||
}
|
||||
|
||||
protected void type(@NonNls String s) {
|
||||
protected void type(@NonNls @NotNull String s) {
|
||||
for (char c : s.toCharArray()) {
|
||||
type(c);
|
||||
}
|
||||
@@ -688,7 +695,7 @@ public abstract class CodeInsightTestCase extends PsiTestCase {
|
||||
protected void backspace() {
|
||||
backspace(getEditor());
|
||||
}
|
||||
protected void backspace(final Editor editor) {
|
||||
protected void backspace(@NotNull final Editor editor) {
|
||||
CommandProcessor.getInstance().executeCommand(getProject(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
@@ -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.
|
||||
@@ -25,6 +25,7 @@ import com.intellij.psi.impl.source.PostprocessReformattingAspect;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@@ -71,6 +72,7 @@ public abstract class MultiFileTestCase extends CodeInsightTestCase {
|
||||
PsiTestUtil.addSourceContentToRoots(myModule, rootDir);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
@NonNls
|
||||
protected abstract String getTestRoot();
|
||||
|
||||
@@ -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.
|
||||
@@ -38,6 +38,7 @@ import com.intellij.util.IncorrectOperationException;
|
||||
import org.jdom.Document;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -122,7 +123,7 @@ public abstract class PsiTestCase extends ModuleTestCase {
|
||||
return myFile.findElementAt(offset);
|
||||
}
|
||||
|
||||
protected void configure(String path, String dataName) throws Exception {
|
||||
protected void configure(@NotNull String path, String dataName) throws Exception {
|
||||
myDataRoot = getTestDataPath() + path;
|
||||
|
||||
myTestDataBefore = loadData(dataName);
|
||||
|
||||
+3
-1
@@ -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.
|
||||
@@ -24,11 +24,13 @@ import com.intellij.psi.search.ProjectScope;
|
||||
import com.intellij.refactoring.MultiFileTestCase;
|
||||
import com.intellij.refactoring.rename.RenameProcessor;
|
||||
import junit.framework.Assert;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author ven
|
||||
*/
|
||||
public class RenameUIRelatedTest extends MultiFileTestCase {
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestRoot() {
|
||||
return "/renameUIRelated/";
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* 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.uiDesigner.refactoring;
|
||||
|
||||
import com.intellij.openapi.application.PluginPathManager;
|
||||
@@ -10,6 +25,7 @@ import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.refactoring.MultiFileTestCase;
|
||||
import com.intellij.refactoring.move.moveFilesOrDirectories.MoveFilesOrDirectoriesProcessor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class MoveFileTest extends MultiFileTestCase {
|
||||
@Override
|
||||
@@ -17,6 +33,7 @@ public class MoveFileTest extends MultiFileTestCase {
|
||||
return PluginPathManager.getPluginHomePath("ui-designer") + "/testData";
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestRoot() {
|
||||
return "/move/";
|
||||
|
||||
Reference in New Issue
Block a user