From 9d3d389dd640f491f5a647bf8fa89c2619f4edfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yann=20C=C3=A9bron?= Date: Thu, 28 Aug 2014 16:19:47 +0200 Subject: [PATCH] DomHighlightingLiteTest: generify, tearDown --- .../util/xml/DomHighlightingLiteTest.java | 29 +++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/xml/dom-tests/tests/com/intellij/util/xml/DomHighlightingLiteTest.java b/xml/dom-tests/tests/com/intellij/util/xml/DomHighlightingLiteTest.java index e96d2e40a325..1106a7ae2b4d 100644 --- a/xml/dom-tests/tests/com/intellij/util/xml/DomHighlightingLiteTest.java +++ b/xml/dom-tests/tests/com/intellij/util/xml/DomHighlightingLiteTest.java @@ -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. @@ -76,9 +76,10 @@ public class DomHighlightingLiteTest extends DomTestCase { @Override public XmlTag getXmlTag() { - return file.getDocument().getRootTag(); + return file.getRootTag(); } + @NotNull @Override public Type getDomElementType() { return DomElement.class; @@ -109,6 +110,7 @@ public class DomHighlightingLiteTest extends DomTestCase { return rootElement; } + @NotNull @Override public Class getRootElementClass() { return DomElement.class; @@ -121,6 +123,15 @@ public class DomHighlightingLiteTest extends DomTestCase { }; } + @Override + public void tearDown() throws Exception { + myAnnotationsManager = null; + myElement = null; + myInspectionProfile = null; + + super.tearDown(); + } + public void testEmptyProblemDescriptorInTheBeginning() throws Throwable { assertEmptyHolder(myAnnotationsManager.getProblemHolder(myElement)); } @@ -171,7 +182,7 @@ public class DomHighlightingLiteTest extends DomTestCase { } public void testMockAnnotatingDomInspection() throws Throwable { - myElement.setFileDescription(new DomFileDescription(DomElement.class, "a")); + myElement.setFileDescription(new DomFileDescription(DomElement.class, "a")); assertInstanceOf(myAnnotationsManager.getMockInspection(myElement), MockAnnotatingDomInspection.class); } @@ -216,14 +227,14 @@ public class DomHighlightingLiteTest extends DomTestCase { assertEquals(DomHighlightStatus.INSPECTIONS_FINISHED, myAnnotationsManager.getHighlightStatus(myElement)); } public void testHighlightStatus_MockAnnotatingDomInspection() throws Throwable { - myElement.setFileDescription(new DomFileDescription(DomElement.class, "a")); + myElement.setFileDescription(new DomFileDescription(DomElement.class, "a")); myAnnotationsManager.appendProblems(myElement, createHolder(), MockAnnotatingDomInspection.class); assertEquals(DomHighlightStatus.INSPECTIONS_FINISHED, myAnnotationsManager.getHighlightStatus(myElement)); } public void testHighlightStatus_OtherInspections() throws Throwable { - myElement.setFileDescription(new DomFileDescription(DomElement.class, "a")); + myElement.setFileDescription(new DomFileDescription(DomElement.class, "a")); final MyDomElementsInspection inspection = new MyDomElementsInspection() { @Override @@ -248,7 +259,7 @@ public class DomHighlightingLiteTest extends DomTestCase { } public void testHighlightStatus_OtherInspections2() throws Throwable { - myElement.setFileDescription(new DomFileDescription(DomElement.class, "a")); + myElement.setFileDescription(new DomFileDescription(DomElement.class, "a")); final MyDomElementsInspection inspection = new MyDomElementsInspection() { @Override @@ -276,7 +287,7 @@ public class DomHighlightingLiteTest extends DomTestCase { new MyBasicDomElementsInspection().checkDomElement(element.getId(), createHolder(), DomHighlightingHelperImpl.INSTANCE); } - private class MyDomElementsInspection extends DomElementsInspection { + private static class MyDomElementsInspection extends DomElementsInspection { public MyDomElementsInspection() { super(DomElement.class); } @@ -300,7 +311,7 @@ public class DomHighlightingLiteTest extends DomTestCase { } } - private class MyBasicDomElementsInspection extends BasicDomElementsInspection { + private static class MyBasicDomElementsInspection extends BasicDomElementsInspection { public MyBasicDomElementsInspection() { super(DomElement.class); } @@ -330,7 +341,7 @@ public class DomHighlightingLiteTest extends DomTestCase { } - private static class MyNonHighlightingDomFileDescription extends DomFileDescription { + private static class MyNonHighlightingDomFileDescription extends DomFileDescription { public MyNonHighlightingDomFileDescription() { super(DomElement.class, "a"); }