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.extend.ConverterManager;
19: import org.directwebremoting.extend.CreatorManager;
20: import org.directwebremoting.extend.TypeHintContext;
21: import org.easymock.EasyMock;
22: import org.junit.Before;
23: import org.junit.Test;
24:
25: /**
26: * @author Bram Smeets
27: * @author Joe Walker [joe at getahead dot ltd dot uk]
28: */
29: public class SignatureParserTest {
30: private SignatureParser parser;
31:
32: private ConverterManager converterManager;
33:
34: private CreatorManager creatorManager;
35:
36: @Before
37: public void setUp() throws Exception {
38: converterManager = EasyMock.createMock(ConverterManager.class);
39: creatorManager = EasyMock.createMock(CreatorManager.class);
40: parser = new SignatureParser(converterManager, creatorManager);
41: }
42:
43: @Test
44: public void testParseEmptyString() throws Exception {
45: EasyMock.replay(converterManager);
46: parser.parse("");
47: EasyMock.verify(converterManager);
48: }
49:
50: @Test
51: public void testParse1() {
52: //TypeHintContext thc = new TypeHintContext((Method) EasyMock.isA(Method.class), EasyMock.eq(0));
53: converterManager
54: .setExtraTypeInfo(EasyMock.isA(TypeHintContext.class),
55: EasyMock.eq(Integer.class));
56:
57: EasyMock.replay(converterManager);
58: parser
59: .parse("import java.util.*;\n"
60: + " import org.directwebremoting.impl.test.SignatureTestsObject;\n"
61: + " public void SignatureTestsObject.setLotteryResults(List<Integer> nos);");
62: EasyMock.verify(converterManager);
63: }
64:
65: @Test
66: public void parse2() {
67: EasyMock.replay(converterManager);
68: parser
69: .parse("import java.util.List;\n"
70: + " SignatureTestsObject.setLotteryResults(List<Integer>);");
71: EasyMock.verify(converterManager);
72: }
73: }
|