01: /*
02: * Copyright 2005 Joe Walker
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.directwebremoting.impl;
17:
18: import org.directwebremoting.create.NewCreator;
19: import org.directwebremoting.extend.Creator;
20: import org.junit.Assert;
21: import org.junit.Test;
22:
23: /**
24: * @author Bram Smeets
25: * @author Joe Walker [joe at getahead dot ltd dot uk]
26: */
27: public class DefaultCreatorManagerTest {
28: private DefaultCreatorManager manager = new DefaultCreatorManager();
29:
30: @Test
31: public void addCreatorTypeNull() {
32: int before = manager.creatorTypes.size();
33: manager.addCreatorType(null, null);
34: manager.addCreatorType(null, this .getClass().getName());
35: manager.addCreatorType(null, Creator.class.getName());
36: int after = manager.creatorTypes.size();
37: Assert.assertEquals(before, after);
38: }
39:
40: @Test(expected=Exception.class)
41: public void addCreatorTypeFail2() {
42: manager.addCreatorType("foo", null);
43: }
44:
45: @Test
46: public void addCreatorType() {
47: manager.addCreatorType("foo", NewCreator.class.getName());
48: }
49:
50: @Test
51: public void addCreator() {
52: NewCreator creator = new NewCreator();
53: manager.addCreator(null, creator);
54: }
55: }
|