EventListenerProxyTest.java revision f6c387128427e121477c1b32ad35cdcaa5101ba3
1/*
2 * Copyright (C) 2008 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
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
17package org.apache.harmony.luni.tests.java.util;
18
19import dalvik.annotation.TestTargets;
20import dalvik.annotation.TestLevel;
21import dalvik.annotation.TestTargetNew;
22import dalvik.annotation.TestTargetClass;
23
24import junit.framework.TestCase;
25
26import java.util.EventListener;
27import java.util.EventListenerProxy;
28
29@TestTargetClass(EventListenerProxy.class)
30public class EventListenerProxyTest extends TestCase {
31
32    class Mock_EventListener implements EventListener {
33
34    }
35
36    class Mock_EventListenerProxy extends EventListenerProxy {
37
38        public Mock_EventListenerProxy(EventListener listener) {
39            super(listener);
40        }
41
42    }
43
44    @TestTargetNew(
45        level = TestLevel.COMPLETE,
46        notes = "",
47        method = "EventListenerProxy",
48        args = {java.util.EventListener.class}
49    )
50    public void testEventListenerProxy() {
51        assertNotNull(new Mock_EventListenerProxy(null));
52        assertNotNull(new Mock_EventListenerProxy(new Mock_EventListener()));
53    }
54
55    @TestTargetNew(
56        level = TestLevel.COMPLETE,
57        notes = "",
58        method = "getListener",
59        args = {}
60    )
61    public void testGetListener() {
62        EventListener el = new Mock_EventListener();
63        EventListenerProxy elp = new Mock_EventListenerProxy(el);
64
65        assertSame(el, elp.getListener());
66    }
67
68}
69