KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jacorb > test > notification > plugins > FilterFactoryTest


1 package org.jacorb.test.notification.plugins;
2
3 /*
4  * JacORB - a free Java ORB
5  *
6  * Copyright (C) 1997-2003 Gerald Brose.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the Free
20  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  */

22
23 import junit.framework.Test;
24
25 import org.jacorb.notification.filter.bsh.BSHFilter;
26 import org.jacorb.test.notification.common.NotifyServerTestCase;
27 import org.jacorb.test.notification.common.NotifyServerTestSetup;
28 import org.omg.CosNotifyFilter.Filter;
29 import org.omg.CosNotifyFilter.FilterFactory;
30
31 /**
32  * @author Alphonse Bendt
33  * @version $Id: FilterFactoryTest.java,v 1.4 2005/05/14 20:49:33 alphonse.bendt Exp $
34  */

35 public class FilterFactoryTest extends NotifyServerTestCase
36 {
37     private FilterFactory objectUnderTest_;
38
39     public void setUpTest() throws Exception JavaDoc
40     {
41         objectUnderTest_ = getDefaultChannel().default_filter_factory();
42     }
43
44     public FilterFactoryTest(String JavaDoc name, NotifyServerTestSetup setup)
45     {
46         super(name, setup);
47     }
48
49     public void testCreateBSHFilter() throws Exception JavaDoc
50     {
51         Filter _filter = objectUnderTest_.create_filter(BSHFilter.CONSTRAINT_GRAMMAR);
52
53         assertEquals(BSHFilter.CONSTRAINT_GRAMMAR, _filter.constraint_grammar());
54     }
55
56     public void testCreateNonExisting() throws Exception JavaDoc
57     {
58         try
59         {
60             objectUnderTest_.create_filter("ACME");
61             fail();
62         } catch (Exception JavaDoc e)
63         {
64             // expected
65
}
66     }
67
68     public static Test suite() throws Exception JavaDoc
69     {
70         return NotifyServerTestCase.suite(FilterFactoryTest.class);
71     }
72 }
Popular Tags