1 19 20 package org.netbeans.modules.editor; 21 22 import java.net.URL ; 23 import java.awt.Color ; 24 import junit.framework.TestCase; 25 import org.netbeans.editor.AnnotationType; 26 import org.netbeans.editor.AnnotationTypes; 27 28 32 public class AnnotationLoadingTest extends TestCase { 33 34 public AnnotationLoadingTest(String testName) { 35 super(testName); 36 } 37 38 41 protected void setUp() throws Exception { 42 EditorTestLookup.setLookup( 43 new URL [] { 44 EditorTestConstants.EDITOR_LAYER_URL, 45 getClass().getClassLoader().getResource( 46 "org/netbeans/modules/editor/resources/annotations-test-layer.xml") 47 }, 48 new Object [] {}, 49 getClass().getClassLoader() 50 ); 51 52 AnnotationTypes.getTypes().registerLoader(new AnnotationsTest.AnnotationsLoader()); 53 } 54 55 public void testAnnotationStatusAndColorRead() { 56 assertEquals(AnnotationType.Severity.STATUS_ERROR, AnnotationTypes.getTypes().getType("test-annotation-1").getSeverity()); 60 assertEquals(false, AnnotationTypes.getTypes().getType("test-annotation-1").isUseCustomSidebarColor()); 61 assertEquals(0, AnnotationTypes.getTypes().getType("test-annotation-1").getPriority()); 62 assertEquals(AnnotationType.Severity.STATUS_WARNING, AnnotationTypes.getTypes().getType("test-annotation-2").getSeverity()); 67 assertEquals(false, AnnotationTypes.getTypes().getType("test-annotation-2").isUseCustomSidebarColor()); 68 assertEquals(100, AnnotationTypes.getTypes().getType("test-annotation-2").getPriority()); 69 assertEquals(AnnotationType.Severity.STATUS_OK, AnnotationTypes.getTypes().getType("test-annotation-3").getSeverity()); 73 assertEquals(false, AnnotationTypes.getTypes().getType("test-annotation-3").isUseCustomSidebarColor()); 74 assertEquals(AnnotationType.Severity.STATUS_ERROR, AnnotationTypes.getTypes().getType("test-annotation-4").getSeverity()); 79 assertEquals(true, AnnotationTypes.getTypes().getType("test-annotation-4").isUseCustomSidebarColor()); 80 assertEquals(new Color (0, 0, 0), AnnotationTypes.getTypes().getType("test-annotation-4").getCustomSidebarColor()); 81 assertEquals(AnnotationType.Severity.STATUS_WARNING, AnnotationTypes.getTypes().getType("test-annotation-5").getSeverity()); 86 assertEquals(true, AnnotationTypes.getTypes().getType("test-annotation-5").isUseCustomSidebarColor()); 87 assertEquals(new Color (0, 0, 0), AnnotationTypes.getTypes().getType("test-annotation-5").getCustomSidebarColor()); 88 assertEquals(AnnotationType.Severity.STATUS_OK, AnnotationTypes.getTypes().getType("test-annotation-6").getSeverity()); 93 assertEquals(true, AnnotationTypes.getTypes().getType("test-annotation-6").isUseCustomSidebarColor()); 94 assertEquals(new Color (0, 0, 0), AnnotationTypes.getTypes().getType("test-annotation-6").getCustomSidebarColor()); 95 assertEquals(AnnotationType.Severity.STATUS_NONE, AnnotationTypes.getTypes().getType("test-annotation-8").getSeverity()); 106 assertEquals(false, AnnotationTypes.getTypes().getType("test-annotation-8").isUseCustomSidebarColor()); 107 assertTrue(AnnotationTypes.getTypes().getType("test-annotation-browseable-1").isBrowseable()); 112 assertFalse(AnnotationTypes.getTypes().getType("test-annotation-browseable-2").isBrowseable()); 117 } 118 119 131 public void testNotFoundAnnotation() { 132 assertNull(AnnotationTypes.getTypes().getType("non-existent")); 133 } 134 135 } 136 | Popular Tags |