1 18 package org.apache.activemq.filter; 19 20 import org.apache.commons.logging.Log; 21 import org.apache.commons.logging.LogFactory; 22 23 import junit.framework.TestCase; 24 25 29 public class BadDummyPolicyConfigTest extends TestCase { 30 31 protected static final Log log = LogFactory.getLog(BadDummyPolicyConfigTest.class); 32 protected DummyPolicy policy = new DummyPolicy(); 33 34 public void testNoDestinationSpecified() throws Exception { 35 DummyPolicyEntry entry = new DummyPolicyEntry(); 36 entry.setDescription("cheese"); 37 38 assertFailsToSetEntries(entry); 39 } 40 41 public void testNoValueSpecified() throws Exception { 42 DummyPolicyEntry entry = new DummyPolicyEntry(); 43 entry.setTopic("FOO.BAR"); 44 45 assertFailsToSetEntries(entry); 46 } 47 48 public void testValidEntry() throws Exception { 49 DummyPolicyEntry entry = new DummyPolicyEntry(); 50 entry.setDescription("cheese"); 51 entry.setTopic("FOO.BAR"); 52 53 entry.afterPropertiesSet(); 54 } 55 56 protected void assertFailsToSetEntries(DummyPolicyEntry entry) throws Exception { 57 try { 58 entry.afterPropertiesSet(); 59 } 60 catch (IllegalArgumentException e) { 61 log.info("Worked! Caught expected exception: " + e); 62 } 63 } 64 } 65 | Popular Tags |