DomHighlightingLiteTest: generify, tearDown

This commit is contained in:
Yann Cébron
2014-08-28 16:19:47 +02:00
parent 98fc30f473
commit 9d3d389dd6
@@ -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>(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>(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>(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>(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<DomElement> {
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<DomElement> {
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<DomElement> {
public MyNonHighlightingDomFileDescription() {
super(DomElement.class, "a");
}