1 19 20 package org.netbeans.modules.xml.xam.ui.highlight; 21 22 import java.util.Set ; 23 import junit.framework.Test; 24 import junit.framework.TestCase; 25 import junit.framework.TestSuite; 26 import org.netbeans.modules.xml.schema.model.Schema; 27 import org.netbeans.modules.xml.schema.model.SchemaModel; 28 import org.netbeans.modules.xml.xam.ui.Util; 29 30 35 public class HighlightGroupTest extends TestCase { 36 private Schema schema; 37 private SchemaModel model; 38 39 public HighlightGroupTest(String testName) { 40 super(testName); 41 } 42 43 @Override 44 protected void setUp() throws Exception { 45 model = Util.loadSchemaModel(Util.PO_XSD); 46 schema = model.getSchema(); 47 } 48 49 @Override 50 protected void tearDown() throws Exception { 51 } 52 53 56 public void testType() { 57 String expResult = "type"; 58 HighlightGroup instance = new HighlightGroup(expResult); 59 String result = instance.getType(); 60 assertEquals(expResult, result); 61 } 62 63 66 public void testShowing() { 67 HighlightGroup instance = new HighlightGroup("type"); 68 assertFalse(instance.isShowing()); 69 instance.setShowing(true); 70 assertTrue(instance.isShowing()); 71 instance.setShowing(false); 72 assertFalse(instance.isShowing()); 73 } 74 75 78 public void testHighlights() { 79 Highlight hl = new TestHighlight(schema, "a"); 80 HighlightGroup instance = new HighlightGroup("type"); 81 instance.addHighlight(hl); 82 Set <Highlight> set = instance.highlights(); 83 assertEquals(1, set.size()); 84 hl = new TestHighlight(schema, "b"); 85 instance.addHighlight(hl); 86 set = instance.highlights(); 87 assertEquals(2, set.size()); 88 } 89 } 90 | Popular Tags |