KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > hivemind > test > rules > TestServicePointTranslator


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.rules;
16
17 import org.apache.hivemind.impl.ServicePointImpl;
18 import org.apache.hivemind.internal.Module;
19 import org.apache.hivemind.internal.ServicePoint;
20 import org.apache.hivemind.schema.Translator;
21 import org.apache.hivemind.schema.rules.ServicePointTranslator;
22 import org.apache.hivemind.test.HiveMindTestCase;
23 import org.easymock.MockControl;
24
25 /**
26  * Test for the {@link org.apache.hivemind.schema.rules.ServicePointTranslator}.
27  *
28  * @author Howard Lewis Ship
29  */

30 public class TestServicePointTranslator extends HiveMindTestCase
31 {
32     public void testServicePointTranslator()
33     {
34         MockControl control = newControl(Module.class);
35         Module m = (Module) control.getMock();
36
37         ServicePoint sp = new ServicePointImpl(m, null);
38
39         m.getServicePoint("Fred");
40         control.setReturnValue(sp);
41
42         replayControls();
43
44         Translator t = new ServicePointTranslator();
45
46         ServicePoint result = (ServicePoint) t.translate(m, null, "Fred", null);
47
48         assertSame(sp, result);
49
50         verifyControls();
51     }
52 }
53
Popular Tags