KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > nanocontainer > aop > defaults > KeyEqualsComponentPointcutTestCase


1 /*****************************************************************************
2  * Copyright (c) PicoContainer Organization. All rights reserved. *
3  * ------------------------------------------------------------------------- *
4  * The software in this package is published under the terms of the BSD *
5  * style license a copy of which has been included with this distribution in *
6  * the LICENSE.txt file. *
7  * *
8  * Idea by Rachel Davies, Original code by various *
9  *****************************************************************************/

10 package org.nanocontainer.aop.defaults;
11
12 import junit.framework.TestCase;
13 import org.nanocontainer.aop.ComponentPointcut;
14
15 /**
16  * @author Stephen Molitor
17  */

18 public class KeyEqualsComponentPointcutTestCase extends TestCase {
19
20     public void testPicks() {
21         ComponentPointcut pointcutA = new KeyEqualsComponentPointcut("a");
22         ComponentPointcut pointcutB = new KeyEqualsComponentPointcut("b");
23
24         assertTrue(pointcutA.picks("a"));
25         assertFalse(pointcutA.picks("b"));
26         assertFalse(pointcutB.picks("a"));
27         assertTrue(pointcutB.picks("b"));
28     }
29
30     public void testConstructorChecksForNullComponentKey() {
31         try {
32             new KeyEqualsComponentPointcut(null);
33             fail("NullPointerException should have been raised");
34         } catch (NullPointerException JavaDoc e) {
35         }
36     }
37
38 }
Popular Tags