1 52 53 package org.jivesoftware.smack.filter; 54 55 import junit.framework.TestCase; 56 import org.jivesoftware.smack.packet.*; 57 58 61 public class NotFilterTest extends TestCase { 62 63 public void testNullArgs() { 64 PacketFilter filter = null; 65 try { 66 NotFilter or = new NotFilter(filter); 67 fail("Should have thrown IllegalArgumentException"); 68 } 69 catch (IllegalArgumentException e) { 70 assertTrue(true); 71 } 72 } 73 74 public void testAccept() { 75 MockPacketFilter trueFilter = new MockPacketFilter(true); 76 MockPacketFilter falseFilter = new MockPacketFilter(false); 77 78 MockPacket packet = new MockPacket(); 79 80 NotFilter NotFilter = new NotFilter(trueFilter); 81 assertFalse(NotFilter.accept(packet)); 82 83 NotFilter = new NotFilter(falseFilter); 84 assertTrue(NotFilter.accept(packet)); 85 } 86 } 87 | Popular Tags |