01: /*****************************************************************************
02: * Copyright (c) PicoContainer Organization. All rights reserved. *
03: * ------------------------------------------------------------------------- *
04: * The software in this package is published under the terms of the BSD *
05: * style license a copy of which has been included with this distribution in *
06: * the LICENSE.txt file. *
07: * *
08: * Idea by Rachel Davies, Original code by various *
09: *****************************************************************************/package org.nanocontainer.aop.defaults;
10:
11: import junit.framework.TestCase;
12: import org.nanocontainer.aop.ComponentPointcut;
13:
14: /**
15: * @author Stephen Molitor
16: */
17: public class KeyEqualsComponentPointcutTestCase extends TestCase {
18:
19: public void testPicks() {
20: ComponentPointcut pointcutA = new KeyEqualsComponentPointcut(
21: "a");
22: ComponentPointcut pointcutB = new KeyEqualsComponentPointcut(
23: "b");
24:
25: assertTrue(pointcutA.picks("a"));
26: assertFalse(pointcutA.picks("b"));
27: assertFalse(pointcutB.picks("a"));
28: assertTrue(pointcutB.picks("b"));
29: }
30:
31: public void testConstructorChecksForNullComponentKey() {
32: try {
33: new KeyEqualsComponentPointcut(null);
34: fail("NullPointerException should have been raised");
35: } catch (NullPointerException e) {
36: }
37: }
38:
39: }
|