1 7 8 package test.compliance.notification; 9 10 import javax.management.AttributeChangeNotificationFilter; 11 12 import junit.framework.TestCase; 13 14 18 public class AttributeChangeNotificationFilterTestCase 19 extends TestCase 20 { 21 22 24 27 public AttributeChangeNotificationFilterTestCase(String s) 28 { 29 super(s); 30 } 31 32 34 public void testGetEnabledAttributes() 35 { 36 AttributeChangeNotificationFilter filter = new AttributeChangeNotificationFilter(); 37 38 assertTrue(filter.getEnabledAttributes().size() == 0); 39 40 filter.enableAttribute("foo"); 41 filter.enableAttribute("bar"); 42 43 assertTrue(filter.getEnabledAttributes().size() == 2); 44 } 45 46 public void testDisableAttribute() 47 { 48 AttributeChangeNotificationFilter filter = new AttributeChangeNotificationFilter(); 49 50 filter.enableAttribute("foo"); 51 filter.enableAttribute("bar"); 52 53 assertTrue(filter.getEnabledAttributes().size() == 2); 54 55 filter.disableAttribute("foo"); 56 57 assertTrue(filter.getEnabledAttributes().size() == 1); 58 assertTrue(filter.getEnabledAttributes().get(0).equals("bar")); 59 60 filter.disableAllAttributes(); 61 62 assertTrue(filter.getEnabledAttributes().size() == 0); 63 64 } 65 66 } 67 | Popular Tags |