diff --git a/java/java-tests/testData/codeInsight/documentation/inherit.gif b/java/java-tests/testData/codeInsight/documentation/inherit.gif deleted file mode 100644 index c814867a13de..000000000000 Binary files a/java/java-tests/testData/codeInsight/documentation/inherit.gif and /dev/null differ diff --git a/java/java-tests/testData/codeInsight/documentation/library-javadoc.jar b/java/java-tests/testData/codeInsight/documentation/library-javadoc.jar new file mode 100644 index 000000000000..1b4c02715e2f Binary files /dev/null and b/java/java-tests/testData/codeInsight/documentation/library-javadoc.jar differ diff --git a/java/java-tests/testData/codeInsight/documentation/library.jar b/java/java-tests/testData/codeInsight/documentation/library.jar new file mode 100644 index 000000000000..09fef7afaa5f Binary files /dev/null and b/java/java-tests/testData/codeInsight/documentation/library.jar differ diff --git a/java/java-tests/testData/codeInsight/javadocIG/annotations.html b/java/java-tests/testData/codeInsight/javadocIG/annotations.html index 39e57472104c..7e9221d07a7c 100644 --- a/java/java-tests/testData/codeInsight/javadocIG/annotations.html +++ b/java/java-tests/testData/codeInsight/javadocIG/annotations.html @@ -1,3 +1,3 @@ -
Test@Nullable +Test@Nullable @\ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/javadocIG/annotationsInParams.html b/java/java-tests/testData/codeInsight/javadocIG/annotationsInParams.html index c9b08d63be93..4a2857980f66 100644 --- a/java/java-tests/testData/codeInsight/javadocIG/annotationsInParams.html +++ b/java/java-tests/testData/codeInsight/javadocIG/annotationsInParams.html @@ -1,2 +1,2 @@ -DeprecatedpublicStringfield = nullTestpublic void foo(@DeprecatedStrings, +Testpublic void foo(@\ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/javadocIG/anonymousAndSuperJavadoc.html b/java/java-tests/testData/codeInsight/javadocIG/anonymousAndSuperJavadoc.html index 05d80ff67146..d40287710f13 100644 --- a/java/java-tests/testData/codeInsight/javadocIG/anonymousAndSuperJavadoc.html +++ b/java/java-tests/testData/codeInsight/javadocIG/anonymousAndSuperJavadoc.html @@ -1,4 +1,4 @@ -DeprecatedStrings, @DeprecatedStringp)+ public void foo()
Foofoo in interface FooTestpublic void foo()
Testpublic void foo()
class MethodTypeParam<T> + class MethodTypeParam<T> extendsObject
<T> - type param@Bar(Baz.CONST, value = {Baz.CONST}) + @\ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/javadocIG/code.html b/java/java-tests/testData/codeInsight/javadocIG/code.html index e75e09176a2f..fe44bd264515 100644 --- a/java/java-tests/testData/codeInsight/javadocIG/code.html +++ b/java/java-tests/testData/codeInsight/javadocIG/code.html @@ -1,4 +1,4 @@ -Bar(Baz.CONST, value = {Baz.CONST}) class Foo extendsObjectFooint foo+Fooint fooclass Clazzz { diff --git a/java/java-tests/testData/codeInsight/javadocIG/commaInsideArgsList.html b/java/java-tests/testData/codeInsight/javadocIG/commaInsideArgsList.html index 4fb3721930dd..6dd479297932 100644 --- a/java/java-tests/testData/codeInsight/javadocIG/commaInsideArgsList.html +++ b/java/java-tests/testData/codeInsight/javadocIG/commaInsideArgsList.html @@ -1 +1 @@ -Testpublic\ No newline at end of file +Stringfield = foo("", "")Testpublic\ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/javadocIG/constantFieldInitializer.html b/java/java-tests/testData/codeInsight/javadocIG/constantFieldInitializer.html index 3965d05b5cd8..b717a2f9fe12 100644 --- a/java/java-tests/testData/codeInsight/javadocIG/constantFieldInitializer.html +++ b/java/java-tests/testData/codeInsight/javadocIG/constantFieldInitializer.html @@ -1,2 +1,2 @@ -Stringfield = foo("", "")Testpublic static final int field = +Testpublic static final int field = Resolved value: 2\ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/javadocIG/enumConstantOrdinal.html b/java/java-tests/testData/codeInsight/javadocIG/enumConstantOrdinal.html index 613de9167782..263a86d9e844 100644 --- a/java/java-tests/testData/codeInsight/javadocIG/enumConstantOrdinal.html +++ b/java/java-tests/testData/codeInsight/javadocIG/enumConstantOrdinal.html @@ -1,2 +1,2 @@ -EEA +E\ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/javadocIG/enumValueOf.html b/java/java-tests/testData/codeInsight/javadocIG/enumValueOf.html index c17fb4e85adb..f4612645900a 100644 --- a/java/java-tests/testData/codeInsight/javadocIG/enumValueOf.html +++ b/java/java-tests/testData/codeInsight/javadocIG/enumValueOf.html @@ -1,4 +1,4 @@ -EA Enum constant ordinal: 0En@org.jetbrains.annotations.Contract(pure = true) +En@myjavadocorg.jetbrains.annotations.Contract(pure = true) static int valueOf(int i)
- Parameters:
i-\ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/javadocIG/escapeValues.html b/java/java-tests/testData/codeInsight/javadocIG/escapeValues.html index e35bd271bef2..fb0fd6cfd520 100644 --- a/java/java-tests/testData/codeInsight/javadocIG/escapeValues.html +++ b/java/java-tests/testData/codeInsight/javadocIG/escapeValues.html @@ -1,3 +1,3 @@ -
- Returns:
class Pattern + class Pattern extends\W \u03A9 \ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/javadocIG/fieldValue.html b/java/java-tests/testData/codeInsight/javadocIG/fieldValue.html index b15488d777a2..aaed481d0b2a 100644 --- a/java/java-tests/testData/codeInsight/javadocIG/fieldValue.html +++ b/java/java-tests/testData/codeInsight/javadocIG/fieldValue.html @@ -1 +1 @@ -ObjectApublic static int JAVADOC_ME = 23The value of the field is 23. \ No newline at end of file +Apublic static int JAVADOC_ME = 23The value of the field is 23. \ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/javadocIG/ideadev2326.html b/java/java-tests/testData/codeInsight/javadocIG/ideadev2326.html index e5f6c9fb03ba..cbd53c283549 100644 --- a/java/java-tests/testData/codeInsight/javadocIG/ideadev2326.html +++ b/java/java-tests/testData/codeInsight/javadocIG/ideadev2326.html @@ -1,2 +1,2 @@ -Idea4780publicObjectread() +Idea4780publicObjectread() throwsIOException\ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/javadocIG/inheritedDocInThrows.html b/java/java-tests/testData/codeInsight/javadocIG/inheritedDocInThrows.html index 7a32b50deb34..81df52edfebd 100644 --- a/java/java-tests/testData/codeInsight/javadocIG/inheritedDocInThrows.html +++ b/java/java-tests/testData/codeInsight/javadocIG/inheritedDocInThrows.html @@ -1,2 +1,2 @@ -
- Throws:
IOException- if an I/O error occurs while reading.EOFException- if this source is already closed when theread()is called, or is closed during theread().- InterruptedIOException - if the reading thread is interrupted.
InheritedDocInThrowsvoid foo() +InheritedDocInThrowsvoid foo() throwsIOException
- Overrides:
fooin classA\ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/javadocIG/inheritedDocInThrows1.html b/java/java-tests/testData/codeInsight/javadocIG/inheritedDocInThrows1.html index 59796e76cd2a..f27a0850f389 100644 --- a/java/java-tests/testData/codeInsight/javadocIG/inheritedDocInThrows1.html +++ b/java/java-tests/testData/codeInsight/javadocIG/inheritedDocInThrows1.html @@ -1,2 +1,2 @@ -
- Throws:
IOException- la-la-laInheritedDocInThrows1void foo() +InheritedDocInThrows1void foo() throwsIOException
- Overrides:
fooin classA\ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/javadocIG/inheritedParameter.html b/java/java-tests/testData/codeInsight/javadocIG/inheritedParameter.html index a95cc830123b..7beb470a63d9 100644 --- a/java/java-tests/testData/codeInsight/javadocIG/inheritedParameter.html +++ b/java/java-tests/testData/codeInsight/javadocIG/inheritedParameter.html @@ -1 +1 @@ -
- Throws:
IOException- commentStringss- String parameter. \ No newline at end of file +Stringss- String parameter. \ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/javadocIG/initializerWithLiteral.html b/java/java-tests/testData/codeInsight/javadocIG/initializerWithLiteral.html index 57ca00a717a2..da0954aa05e1 100644 --- a/java/java-tests/testData/codeInsight/javadocIG/initializerWithLiteral.html +++ b/java/java-tests/testData/codeInsight/javadocIG/initializerWithLiteral.html @@ -1 +1 @@ -Apublic\ No newline at end of file +Stringstrings = "A<BLANK>B"Apublic\ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/javadocIG/initializerWithNew.html b/java/java-tests/testData/codeInsight/javadocIG/initializerWithNew.html index d11e238610a6..7032c0345290 100644 --- a/java/java-tests/testData/codeInsight/javadocIG/initializerWithNew.html +++ b/java/java-tests/testData/codeInsight/javadocIG/initializerWithNew.html @@ -1 +1 @@ -Stringstrings = "A<BLANK>B"Apublic\ No newline at end of file +List<String> strings = newArrayList<String>(newArrayList<Integer>(), Collections.singleton(newArrayList<Double>()))Apublic\ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/javadocIG/initializerWithReference.html b/java/java-tests/testData/codeInsight/javadocIG/initializerWithReference.html index f4ba3cbff9d1..8780018d1a33 100644 --- a/java/java-tests/testData/codeInsight/javadocIG/initializerWithReference.html +++ b/java/java-tests/testData/codeInsight/javadocIG/initializerWithReference.html @@ -1 +1 @@ -List<String> strings = newArrayList<String>(newArrayList<Integer>(), Collections.singleton(newArrayList<Double>()))Testpublic int field = anotherField\ No newline at end of file +Testpublic int field = anotherField\ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/javadocIG/lambdaParameter.html b/java/java-tests/testData/codeInsight/javadocIG/lambdaParameter.html index 31697926bc91..bc06e7ab63ac 100644 --- a/java/java-tests/testData/codeInsight/javadocIG/lambdaParameter.html +++ b/java/java-tests/testData/codeInsight/javadocIG/lambdaParameter.html @@ -1 +1 @@ -int a\ No newline at end of file + int a\ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/javadocIG/literal.html b/java/java-tests/testData/codeInsight/javadocIG/literal.html index a10aecb5f685..cc4d27b2ac7e 100644 --- a/java/java-tests/testData/codeInsight/javadocIG/literal.html +++ b/java/java-tests/testData/codeInsight/javadocIG/literal.html @@ -1,2 +1,2 @@ -Fooint foo+Fooint foofoo <> \ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/javadocIG/methodExpressionWithLiteral.html b/java/java-tests/testData/codeInsight/javadocIG/methodExpressionWithLiteral.html index 5d73a26bc75f..9f87e83ded00 100644 --- a/java/java-tests/testData/codeInsight/javadocIG/methodExpressionWithLiteral.html +++ b/java/java-tests/testData/codeInsight/javadocIG/methodExpressionWithLiteral.html @@ -1 +1 @@ -Apublic byte[] bytes = "&".getBytes()\ No newline at end of file +Apublic byte[] bytes = "&".getBytes()\ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/javadocIG/methodFormatting.html b/java/java-tests/testData/codeInsight/javadocIG/methodFormatting.html index 9cb61794114c..9d9f05b90d62 100644 --- a/java/java-tests/testData/codeInsight/javadocIG/methodFormatting.html +++ b/java/java-tests/testData/codeInsight/javadocIG/methodFormatting.html @@ -1,3 +1,3 @@ -Producer<E extendsException> void drainTo(Consumer<? super T, E> consumer, +Producer<E extendsException> void drainTo(Consumer<? super T, E> consumer,ObjectsomeParameter) throwsE\ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/javadocIG/methodTypeParameter.html b/java/java-tests/testData/codeInsight/javadocIG/methodTypeParameter.html index 86ed662f15eb..f3258f5d7159 100644 --- a/java/java-tests/testData/codeInsight/javadocIG/methodTypeParameter.html +++ b/java/java-tests/testData/codeInsight/javadocIG/methodTypeParameter.html @@ -1 +1 @@ -
- Throws:
EMethodTypeParam<T> void foo(T t)\ No newline at end of file +
- Type parameters:
<T>- type paramMethodTypeParam<T> void foo(T t)\ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/javadocIG/pInsidePre.html b/java/java-tests/testData/codeInsight/javadocIG/pInsidePre.html index fbfd2983208a..514fb157ca91 100644 --- a/java/java-tests/testData/codeInsight/javadocIG/pInsidePre.html +++ b/java/java-tests/testData/codeInsight/javadocIG/pInsidePre.html @@ -1,4 +1,4 @@ -
- Type parameters:
<T>- type paramTestpublic+Stringfield = nullTestpublicStringfield = nullfoo diff --git a/java/java-tests/testData/codeInsight/javadocIG/simpleField.html b/java/java-tests/testData/codeInsight/javadocIG/simpleField.html index 643ceac6cc4b..b2f9b93eb4cd 100644 --- a/java/java-tests/testData/codeInsight/javadocIG/simpleField.html +++ b/java/java-tests/testData/codeInsight/javadocIG/simpleField.html @@ -1 +1 @@ -Apublic static int JAVADOC_METest \ No newline at end of file +Apublic static int JAVADOC_METest \ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/javadocIG/valueInMethod.html b/java/java-tests/testData/codeInsight/javadocIG/valueInMethod.html index 9b2fe7285a70..8342feaa01c7 100644 --- a/java/java-tests/testData/codeInsight/javadocIG/valueInMethod.html +++ b/java/java-tests/testData/codeInsight/javadocIG/valueInMethod.html @@ -1 +1 @@ -Apublic static void JAVADOC_ME()The value of A is 23. \ No newline at end of file +Apublic static void JAVADOC_ME()The value of A is 23. \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/JavaExternalDocumentationTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/JavaExternalDocumentationTest.java new file mode 100644 index 000000000000..1bb26cc0f3e5 --- /dev/null +++ b/java/java-tests/testSrc/com/intellij/codeInsight/JavaExternalDocumentationTest.java @@ -0,0 +1,127 @@ +/* + * Copyright 2000-2015 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; + +import com.intellij.JavaTestUtil; +import com.intellij.codeInsight.documentation.DocumentationComponent; +import com.intellij.codeInsight.documentation.DocumentationManager; +import com.intellij.lang.java.JavaLanguage; +import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.editor.Document; +import com.intellij.openapi.editor.Editor; +import com.intellij.openapi.editor.EditorFactory; +import com.intellij.openapi.module.Module; +import com.intellij.openapi.module.ModuleManager; +import com.intellij.openapi.roots.JavadocOrderRootType; +import com.intellij.openapi.roots.ModuleRootModificationUtil; +import com.intellij.openapi.roots.OrderRootType; +import com.intellij.openapi.roots.libraries.Library; +import com.intellij.openapi.roots.libraries.LibraryTablesRegistrar; +import com.intellij.openapi.ui.popup.JBPopup; +import com.intellij.openapi.util.Disposer; +import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.vfs.JarFileSystem; +import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.psi.PsiDocumentManager; +import com.intellij.psi.PsiFile; +import com.intellij.psi.PsiFileFactory; +import com.intellij.testFramework.PlatformTestCase; +import org.jetbrains.annotations.NotNull; + +import javax.swing.*; +import javax.swing.text.html.HTML; +import javax.swing.text.html.HTMLDocument; +import java.io.File; +import java.io.InputStream; +import java.net.URL; + +public class JavaExternalDocumentationTest extends PlatformTestCase { + public void testImagesInsideJavadocJar() throws Exception { + final VirtualFile libClasses = getJarFile("library.jar"); + final VirtualFile libJavadocJar = getJarFile("library-javadoc.jar"); + + ApplicationManager.getApplication().runWriteAction(new Runnable() { + @Override + public void run() { + final Library library = LibraryTablesRegistrar.getInstance().getLibraryTable(myProject).createLibrary("myLib"); + final Library.ModifiableModel model = library.getModifiableModel(); + model.addRoot(libClasses, OrderRootType.CLASSES); + model.addRoot(libJavadocJar, JavadocOrderRootType.getInstance()); + model.commit(); + + Module[] modules = ModuleManager.getInstance(myProject).getModules(); + assertSize(1, modules); + ModuleRootModificationUtil.addDependency(modules[0], library); + } + }); + + PsiFile psiFile = + PsiFileFactory.getInstance(myProject).createFileFromText(JavaLanguage.INSTANCE, "class Foo { com.jetbrains.Test field; }"); + Document document = PsiDocumentManager.getInstance(myProject).getDocument(psiFile); + assertNotNull(document); + Editor editor = EditorFactory.getInstance().createEditor(document, myProject); + try { + editor.getCaretModel().moveToOffset(document.getText().indexOf("Test")); + DocumentationManager documentationManager = DocumentationManager.getInstance(myProject); + documentationManager.showJavaDocInfo(editor, psiFile, false); + JBPopup popup = documentationManager.getDocInfoHint(); + assertNotNull(popup); + DocumentationComponent documentationComponent = (DocumentationComponent)popup.getContent().getComponent(0); + try { + byte[] imageData = getImageDataFromDocumentationComponent(documentationComponent); + assertEquals(228, imageData.length); + } + finally { + Disposer.dispose(documentationComponent); + } + } + finally { + EditorFactory.getInstance().releaseEditor(editor); + } + } + + @NotNull + private static VirtualFile getJarFile(String name) { + VirtualFile file = getVirtualFile(new File(JavaTestUtil.getJavaTestDataPath() + "/codeInsight/documentation/" + name)); + assertNotNull(file); + VirtualFile jarFile = JarFileSystem.getInstance().getJarRootForLocalFile(file); + assertNotNull(jarFile); + return jarFile; + } + + private static byte[] getImageDataFromDocumentationComponent(DocumentationComponent documentationComponent) throws Exception { + JEditorPane editorPane = (JEditorPane)documentationComponent.getComponent(); + HTMLDocument document = (HTMLDocument)editorPane.getDocument(); + HTMLDocument.Iterator it = document.getIterator(HTML.Tag.IMG); + assertTrue(it.isValid()); + String relativeUrl = (String)it.getAttributes().getAttribute(HTML.Attribute.SRC); + it.next(); + assertFalse(it.isValid()); + URL imageUrl = new URL(document.getBase(), relativeUrl); + InputStream stream = imageUrl.openStream(); + try { + return FileUtil.loadBytes(stream); + } + finally { + stream.close(); + } + } + + @Override + protected boolean isRunInWriteAction() { + return false; + } +} diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/javadoc/JavaDocInfoGeneratorTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/javadoc/JavaDocInfoGeneratorTest.java index 5a58e6695ad2..7bb0de06ebf3 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/javadoc/JavaDocInfoGeneratorTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/javadoc/JavaDocInfoGeneratorTest.java @@ -138,19 +138,22 @@ public class JavaDocInfoGeneratorTest extends CodeInsightTestCase { PsiField field = psiClass.getFields() [0]; String docInfo = new JavaDocumentationProvider().generateDoc(field, field); assertNotNull(docInfo); - assertEquals(exampleHtmlFileText(getTestName(true)), StringUtil.convertLineSeparators(docInfo.trim())); + assertEquals(exampleHtmlFileText(getTestName(true)), replaceEnvironmentDependentContent(docInfo)); docInfo = new JavaDocumentationProvider().getQuickNavigateInfo(field, field); assertNotNull(docInfo); - assertEquals(exampleHtmlFileText(getTestName(true) + "_quick"), StringUtil.convertLineSeparators(docInfo.trim())); + assertEquals(exampleHtmlFileText(getTestName(true) + "_quick"), replaceEnvironmentDependentContent(docInfo)); } public void testClickableFieldReference() throws Exception { PsiClass aClass = getTestClass(); PsiTypeElement element = aClass.getFields()[0].getTypeElement(); - String docInfo = new JavaDocumentationProvider().generateDoc(element.getInnermostComponentReferenceElement().resolve(), element); + assertNotNull(element); + PsiJavaCodeReferenceElement innermostComponentReferenceElement = element.getInnermostComponentReferenceElement(); + assertNotNull(innermostComponentReferenceElement); + String docInfo = new JavaDocumentationProvider().generateDoc(innermostComponentReferenceElement.resolve(), element); assertNotNull(docInfo); - assertEquals(exampleHtmlFileText(getTestName(true)), StringUtil.convertLineSeparators(docInfo.trim())); + assertEquals(exampleHtmlFileText(getTestName(true)), replaceEnvironmentDependentContent(docInfo)); } private static String exampleHtmlFileText(String name) throws IOException { @@ -161,12 +164,13 @@ public class JavaDocInfoGeneratorTest extends CodeInsightTestCase { public void testClassTypeParamsPresentation() throws Exception { PsiClass psiClass = getTestClass(); final PsiReferenceList extendsList = psiClass.getExtendsList(); + assertNotNull(extendsList); final PsiJavaCodeReferenceElement referenceElement = extendsList.getReferenceElements()[0]; final PsiClass superClass = extendsList.getReferencedTypes()[0].resolve(); String docInfo = new JavaDocumentationProvider().getQuickNavigateInfo(superClass, referenceElement); assertNotNull(docInfo); - assertEquals(exampleHtmlFileText(getTestName(true)), StringUtil.convertLineSeparators(docInfo.trim())); + assertEquals(exampleHtmlFileText(getTestName(true)), replaceEnvironmentDependentContent(docInfo)); } public void testLambdaParameter() throws Exception { @@ -200,7 +204,7 @@ public class JavaDocInfoGeneratorTest extends CodeInsightTestCase { private void verifyJavaDoc(final PsiElement field) throws IOException { String docInfo = new JavaDocInfoGenerator(getProject(), field).generateDocInfo(null); assertNotNull(docInfo); - assertEquals(exampleHtmlFileText(getTestName(true)), StringUtil.convertLineSeparators(docInfo.trim())); + assertEquals(exampleHtmlFileText(getTestName(true)), replaceEnvironmentDependentContent(docInfo)); } public void testPackageInfo() throws Exception { @@ -211,13 +215,14 @@ public class JavaDocInfoGeneratorTest extends CodeInsightTestCase { new JavaDocInfoGenerator(getProject(), JavaPsiFacade.getInstance(getProject()).findPackage(getTestName(true))).generateDocInfo(null); String htmlText = FileUtil.loadFile(new File(packageInfo + File.separator + "packageInfo.html")); assertNotNull(info); - assertEquals(StringUtil.convertLineSeparators(htmlText.trim()), StringUtil.convertLineSeparators(info.trim())); + assertEquals(StringUtil.convertLineSeparators(htmlText.trim()), replaceEnvironmentDependentContent(info)); } public void testInheritedParameter() throws Exception { configureByFile("/codeInsight/javadocIG/" + getTestName(true) + ".java"); PsiClass outerClass = ((PsiJavaFile) myFile).getClasses()[0]; PsiClass innerClass = outerClass.findInnerClassByName("Impl", false); + assertNotNull(innerClass); PsiParameter parameter = innerClass.getMethods()[0].getParameterList().getParameters()[0]; verifyJavaDoc(parameter); } @@ -226,4 +231,8 @@ public class JavaDocInfoGeneratorTest extends CodeInsightTestCase { protected String getTestDataPath() { return JavaTestUtil.getJavaTestDataPath(); } + + private static String replaceEnvironmentDependentContent(String html) { + return StringUtil.convertLineSeparators(html.trim()).replaceAll("", " "); + } } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationComponent.java b/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationComponent.java index 86116ff6373a..af9dc5f2c869 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationComponent.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationComponent.java @@ -553,7 +553,7 @@ public class DocumentationComponent extends JPanel implements Disposable, DataPr setElement(element); boolean justShown = false; - if (!myIsShown && myHint != null) { + if (!myIsShown && myHint != null && !ApplicationManager.getApplication().isUnitTestMode()) { myEditorPane.setText(text); applyFontSize(); myManager.showHint(myHint); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationManager.java b/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationManager.java index bddd5acc5b5b..9f80b16c868f 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationManager.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationManager.java @@ -642,7 +642,7 @@ public class DocumentationManager extends DockablePopupManager