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.convert;
17:
18: import static org.junit.Assert.*;
19:
20: import org.directwebremoting.extend.InboundContext;
21: import org.directwebremoting.extend.InboundVariable;
22: import org.directwebremoting.extend.OutboundContext;
23: import org.directwebremoting.extend.OutboundVariable;
24: import org.junit.Test;
25:
26: /**
27: * The tests for the <code>ConstructorConverter</code> class.
28: * @see ConstructorConverter
29: * @author Bram Smeets
30: * @author Joe Walker [joe at getahead dot ltd dot uk]
31: */
32: public class ConstructorConverterTest {
33: private ConstructorConverter converter = new ConstructorConverter();
34:
35: @Test
36: public void convertInbound() {
37: InboundContext ctx = new InboundContext();
38: InboundVariable iv = new InboundVariable(ctx, null, "type",
39: "value");
40:
41: Object result = converter.convertInbound(String.class, iv, ctx);
42:
43: assertNotNull(result);
44: assertTrue(result instanceof String);
45: assertEquals("value", result);
46: }
47:
48: @Test
49: public void convertOutbound() {
50: OutboundContext ctx = new OutboundContext(false);
51:
52: OutboundVariable result = converter.convertOutbound("value",
53: ctx);
54:
55: assertNotNull(result);
56: assertEquals("'value'", result.getAssignCode());
57: assertEquals("", result.getBuildCode());
58: }
59:
60: @Test
61: public void setConverterManager() {
62: converter.setConverterManager(null);
63: }
64: }
|