EventObjectTest.java revision 89c1feb0a69a7707b271086e749975b3f7acacf7
1/* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18package tests.api.java.util; 19 20import dalvik.annotation.TestTarget; 21import dalvik.annotation.TestInfo; 22import dalvik.annotation.TestLevel; 23import dalvik.annotation.TestTargetClass; 24 25import java.util.EventObject; 26 27@TestTargetClass(EventObject.class) 28public class EventObjectTest extends junit.framework.TestCase { 29 30 Object myObject; 31 32 EventObject myEventObject; 33 34 /** 35 * @tests java.util.EventObject#EventObject(java.lang.Object) 36 */ 37 @TestInfo( 38 level = TestLevel.TODO, 39 purpose = "Empty test. SetUp method doesn't verify " + 40 "IllegalArgumentException.", 41 targets = { 42 @TestTarget( 43 methodName = "EventObject", 44 methodArgs = {java.lang.Object.class} 45 ) 46 }) 47 public void test_ConstructorLjava_lang_Object() { 48 // Test for method java.util.EventObject(java.lang.Object) 49 assertTrue("Used to test", true); 50 } 51 52 /** 53 * @tests java.util.EventObject#getSource() 54 */ 55 @TestInfo( 56 level = TestLevel.COMPLETE, 57 purpose = "", 58 targets = { 59 @TestTarget( 60 methodName = "getSource", 61 methodArgs = {} 62 ) 63 }) 64 public void test_getSource() { 65 // Test for method java.lang.Object java.util.EventObject.getSource() 66 assertTrue("Wrong source returned", 67 myEventObject.getSource() == myObject); 68 } 69 70 /** 71 * @tests java.util.EventObject#toString() 72 */ 73 @TestInfo( 74 level = TestLevel.COMPLETE, 75 purpose = "", 76 targets = { 77 @TestTarget( 78 methodName = "toString", 79 methodArgs = {} 80 ) 81 }) 82 public void test_toString() { 83 // Test for method java.lang.String java.util.EventObject.toString() 84 assertTrue("Incorrect toString returned: " + myEventObject.toString(), 85 myEventObject.toString().indexOf( 86 "java.util.EventObject[source=java.lang.Object@") == 0); 87 } 88 89 /** 90 * Sets up the fixture, for example, open a network connection. This method 91 * is called before a test is executed. 92 */ 93 protected void setUp() { 94 myObject = new Object(); 95 myEventObject = new EventObject(myObject); 96 } 97 98 /** 99 * Tears down the fixture, for example, close a network connection. This 100 * method is called after a test is executed. 101 */ 102 protected void tearDown() { 103 } 104} 105