Defines an annotation for test classes that allows to link them to the class that is being tested. The current assumption is that the test are somewhat organized according to the API classes they test. Might be too strict for some cases.
Defines an annotation for test classes that allows to link them to the class that is being tested. The current assumption is that the test are somewhat organized according to the API classes they test. Might be too strict for some cases.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# TestTargetClass\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nDeprecated in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nTestTargetClass\n===============\n\n```\n@Target([AnnotationTarget.CLASS, AnnotationTarget.FILE]) class TestTargetClass\n```\n\n|----------------------------------------|\n| [dalvik.annotation.TestTargetClass](#) |\n\n*** ** * ** ***\n\n| **This annotation was deprecated in API level 14.**\n|\n| Obsolete.\n\nDefines an annotation for test classes that allows to link them to the class that is being tested. The current assumption is that the test are somewhat organized according to the API classes they test. Might be too strict for some cases.\n\nSummary\n-------\n\n| Public constructors ||\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [TestTargetClass](#TestTargetClass(kotlin.reflect.KClass))`(`value:` `[KClass](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.reflect/-k-class/index.html)\u003c*\u003e`)` Defines an annotation for test classes that allows to link them to the class that is being tested. |\n\n| Properties ||\n|-------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------|\n| [KClass](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.reflect/-k-class/index.html)\\\u003c\\*\\\u003e | [value](#value:kotlin.reflect.KClass) Specifies the class being tested. |\n\nPublic constructors\n-------------------\n\n### TestTargetClass\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nDeprecated in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nTestTargetClass(value: KClass\u003c*\u003e)\n```\n\n**Deprecated:** *Obsolete.*\n\nDefines an annotation for test classes that allows to link them to the class that is being tested. The current assumption is that the test are somewhat organized according to the API classes they test. Might be too strict for some cases.\n\nProperties\n----------\n\n### value\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nval value: KClass\u003c*\u003e\n```\n\n**Deprecated:** *Deprecated in Java.*\n\nSpecifies the class being tested."]]