Stay organized with collections
Save and categorize content based on your preferences.
TestMethod
open class TestMethod
Represents a test to be run. Can be constructed without instantiating the TestCase or even loading the class.
Summary
Public constructors
TestMethod
TestMethod(
method: Method!,
enclosingClass: Class<out TestCase!>!)
TestMethod
TestMethod(
methodName: String!,
enclosingClass: Class<out TestCase!>!)
TestMethod
TestMethod(testCase: TestCase!)
Public methods
createTest
open fun createTest(): TestCase!
Deprecated: Deprecated in Java.
equals
open fun equals(other: Any?): Boolean
Deprecated: Deprecated in Java.
Parameters |
obj |
the reference object with which to compare. |
Return |
Boolean |
true if this object is the same as the obj argument; false otherwise. |
getAnnotation
open fun <T : Annotation!> getAnnotation(annotationClass: Class<T>!): T
Deprecated: Deprecated in Java.
getEnclosingClass
open fun getEnclosingClass(): Class<out TestCase!>!
Deprecated: Deprecated in Java.
getEnclosingClassname
open fun getEnclosingClassname(): String!
Deprecated: Deprecated in Java.
getName
open fun getName(): String!
Deprecated: Deprecated in Java.
hashCode
open fun hashCode(): Int
Deprecated: Deprecated in Java.
Return |
Int |
a hash code value for this object. |
toString
open fun toString(): String
Deprecated: Deprecated in Java.
Return |
String |
a string representation of the object. |
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# TestMethod\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nDeprecated in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nTestMethod\n==========\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/test/suitebuilder/TestMethod \"View this page in Java\") \n\n```\nopen class TestMethod\n```\n\n|---|-------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.test.suitebuilder.TestMethod](#) |\n\n*** ** * ** ***\n\n| **This class was deprecated in API level 26.**\n|\n| New tests should be written using the [Android Testing Support Library](https://developer.android.com/tools/testing-support-library/index.html).\n\nRepresents a test to be run. Can be constructed without instantiating the TestCase or even loading the class.\n\nSummary\n-------\n\n| Public constructors ||\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [TestMethod](#TestMethod(java.lang.reflect.Method,%20java.lang.Class))`(`method:` `[Method](../../../java/lang/reflect/Method.html#)!`, `enclosingClass:` `[Class](../../../java/lang/Class.html#)\u003cout` `TestCase!\u003e!`)` \u003cbr /\u003e |\n| [TestMethod](#TestMethod(kotlin.String,%20java.lang.Class))`(`methodName:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`, `enclosingClass:` `[Class](../../../java/lang/Class.html#)\u003cout` `TestCase!\u003e!`)` \u003cbr /\u003e |\n| [TestMethod](#TestMethod(TestCase))`(`testCase:` `TestCase!`)` \u003cbr /\u003e |\n\n| Public methods ||\n|-----------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------|\n| open TestCase! | [createTest](#createTest())`()` \u003cbr /\u003e |\n| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [equals](#equals(kotlin.Any))`(`other:` `[Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)?`)` \u003cbr /\u003e |\n| open T | [getAnnotation](#getAnnotation(java.lang.Class))`(`annotationClass:` `[Class](../../../java/lang/Class.html#)\u003cT\u003e!`)` \u003cbr /\u003e |\n| open [Class](../../../java/lang/Class.html#)\\\u003cout TestCase!\\\u003e! | [getEnclosingClass](#getEnclosingClass())`()` \u003cbr /\u003e |\n| open [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | [getEnclosingClassname](#getEnclosingClassname())`()` \u003cbr /\u003e |\n| open [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | [getName](#getName())`()` \u003cbr /\u003e |\n| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [hashCode](#hashCode())`()` \u003cbr /\u003e |\n| open [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [toString](#toString())`()` \u003cbr /\u003e |\n\nPublic constructors\n-------------------\n\n### TestMethod\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nTestMethod(\n method: Method!, \n enclosingClass: Class\u003cout TestCase!\u003e!)\n``` \n\n### TestMethod\n\nAdded in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nTestMethod(\n methodName: String!, \n enclosingClass: Class\u003cout TestCase!\u003e!)\n``` \n\n### TestMethod\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nTestMethod(testCase: TestCase!)\n```\n\nPublic methods\n--------------\n\n### createTest\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun createTest(): TestCase!\n```\n\n**Deprecated:** *Deprecated in Java.* \n\n### equals\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun equals(other: Any?): Boolean\n```\n\n**Deprecated:** *Deprecated in Java.*\n\n| Parameters ||\n|-------|---------------------------------------------|\n| `obj` | the reference object with which to compare. |\n\n| Return ||\n|------------------------------------------------------------------------------------|---------------------------------------------------------------------------|\n| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `true` if this object is the same as the obj argument; `false` otherwise. |\n\n### getAnnotation\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun \u003cT : Annotation!\u003e getAnnotation(annotationClass: Class\u003cT\u003e!): T\n```\n\n**Deprecated:** *Deprecated in Java.* \n\n### getEnclosingClass\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun getEnclosingClass(): Class\u003cout TestCase!\u003e!\n```\n\n**Deprecated:** *Deprecated in Java.* \n\n### getEnclosingClassname\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun getEnclosingClassname(): String!\n```\n\n**Deprecated:** *Deprecated in Java.* \n\n### getName\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun getName(): String!\n```\n\n**Deprecated:** *Deprecated in Java.* \n\n### hashCode\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun hashCode(): Int\n```\n\n**Deprecated:** *Deprecated in Java.*\n\n| Return ||\n|----------------------------------------------------------------------------|------------------------------------|\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | a hash code value for this object. |\n\n### toString\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun toString(): String\n```\n\n**Deprecated:** *Deprecated in Java.*\n\n| Return ||\n|----------------------------------------------------------------------------------|----------------------------------------|\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | a string representation of the object. |"]]