Source code: hivemind/test/services/impl/ConstructorAccessImpl.java
1 // Copyright 2004, 2005 The Apache Software Foundation
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 package hivemind.test.services.impl;
16
17 import java.util.List;
18 import java.util.Map;
19
20 import org.apache.commons.logging.Log;
21 import org.apache.hivemind.Messages;
22
23 import junit.framework.Assert;
24 import junit.framework.AssertionFailedError;
25
26 import hivemind.test.services.ConstructorAccess;
27
28 /**
29 * Used to test constructor parameter passing of
30 * {@link org.apache.hivemind.service.impl.BuilderFactory}.
31 */
32 public class ConstructorAccessImpl implements ConstructorAccess
33 {
34
35 private String actualMessage;
36
37 private String expectedMessage;
38
39 public ConstructorAccessImpl()
40 {
41 actualMessage = "()";
42 }
43
44 public ConstructorAccessImpl(long l)
45 {
46 actualMessage = "(long)";
47 }
48
49 public ConstructorAccessImpl(String string)
50 {
51 actualMessage = "(String)";
52 }
53
54 public ConstructorAccessImpl(ConstructorAccess service)
55 {
56 actualMessage = "(ConstructorAccess)";
57 }
58
59 public ConstructorAccessImpl(ConstructorAccess service, String s)
60 {
61 actualMessage = "(ConstructorAccess, String)";
62 }
63
64 public ConstructorAccessImpl(List configurations)
65 {
66 actualMessage = "(List)";
67 }
68
69 public ConstructorAccessImpl(Map configurations, long l)
70 {
71 actualMessage = "(Map, long)";
72 }
73
74 public ConstructorAccessImpl(Log log, Messages messages)
75 {
76 actualMessage = "(Log, Messages)";
77 }
78
79 public ConstructorAccessImpl(long l, ConstructorAccess nullObject)
80 {
81 actualMessage = "(long, " + nullObject + ")";
82 }
83
84 public void setExpectedConstructorMessage(String expectedMessage)
85 {
86 this.expectedMessage = expectedMessage;
87 }
88
89 public void verify() throws AssertionFailedError
90 {
91 Assert.assertEquals(expectedMessage, actualMessage);
92 }
93
94 }