private static Iterator baseTestClasses()

in tools/device_broker/java/com/google/android/apps/common/testing/suite/dex/DumpUtils.java [558:686]


  private static Iterator<DexClassData> baseTestClasses() {
    // these classes actually live in android.test.runner.jar which is dynamically linked in
    // on the device.
    // I'd rather do this dynamically some time in the future.

    DexClassData.Builder androidBuilder = DexClassData.builder()
        .setIsAbstract(true) // technically false but we dont actually want to run these classes
        .setPackageName("android.test")
        .setVisibility(Visibility.PUBLIC.toString());

    MethodData.MethodBuilder methodBuilder = MethodData.builder()
        .setIsAbstract(false)
        .setHasArguments(false)
        .setHasReturnType(false)
        .setVisibility(Visibility.PUBLIC.toString());

    List<DexClassData> baseClasses = Lists.newArrayList(
        DexClassData.builder()
            .setClassName("TestCase")
            .setVisibility(Visibility.PUBLIC.toString())
            .setExtendsClass("java.lang.Object")
            .setPackageName("junit.framework")
            .setIsAbstract(true)
            .build(),
        androidBuilder
            .setClassName("AndroidTestCase")
            .setExtendsClass("junit.framework.TestCase")
            .clearMethods()
            .addMethod(
                methodBuilder
                    .setMethodName("testAndroidTestCaseSetupProperly")
                    .build().toBuilder()
                    .addAnnotation(AnnotationPb.newBuilder()
                      // Technically it appears as a android.test.suitebuilder.annotation.Suppress
                      // but only in the API 24 sdk, so we have to translate it to a min/max
                      // suppression using the ATSL filter.
                      .setClassName("androidx.test.filters.SdkSuppress")
                      .addAnnotationValue(AnnotationValuePb.newBuilder()
                        .setFieldName("maxSdkVersion")
                        .addFieldValue("23") // its INCLUSIVE - this is the last valid api level.
                        .setFieldType(TestInfo.Type.INTEGER)
                        .setIsArray(false)
                        .build())
                      .build())
                    .build())
            .build(),
        androidBuilder
            .setClassName("ApplicationTestCase")
            .setExtendsClass("android.test.AndroidTestCase")
            .clearMethods()
            .addMethod(
                methodBuilder
                    .setMethodName("testApplicationTestCaseSetUpProperly")
                    .build())
            .build(),
        androidBuilder
            .setClassName("LoaderTestCase")
            .setExtendsClass("android.test.AndroidTestCase")
            .clearMethods()
            .build(),
        androidBuilder
            .setClassName("ProviderTestCase2")
            .setExtendsClass("android.test.AndroidTestCase")
            .clearMethods()
            .build(),
        androidBuilder
            .setClassName("ServiceTestCase")
            .setExtendsClass("android.test.AndroidTestCase")
            .clearMethods()
            .addMethod(
                methodBuilder
                    .setMethodName("testServiceTestCaseSetUpProperly")
                    .build())
            .build(),
        androidBuilder
            .setClassName("InstrumentationTestCase")
            .setExtendsClass("junit.framework.TestCase")
            .clearMethods()
            .build(),
        androidBuilder
            .setClassName("ActivityTestCase")
            .setExtendsClass("android.test.InstrumentationTestCase")
            .clearMethods()
            .build(),
        androidBuilder
            .setClassName("ActivityInstrumentationTestCase")
            .setExtendsClass("android.test.ActivityTestCase")
            .clearMethods()
            .setIsUiTest(true)
            .addMethod(
                methodBuilder
                    .setMethodName("testActivityTestCaseSetUpProperly")
                    .build())
            .build(),
        androidBuilder
            .setClassName("ActivityInstrumentationTestCase2")
            .setExtendsClass("android.test.ActivityTestCase")
            .setIsUiTest(true)
            .clearMethods()
            .build(),
        androidBuilder
            .setIsUiTest(false)
            .setClassName("ActivityUnitTestCase")
            .setExtendsClass("android.test.ActivityTestCase")
            .clearMethods()
            .build(),
        androidBuilder
            .setClassName("ProviderTestCase")
            .setExtendsClass("android.test.InstrumentationTestCase")
            .clearMethods()
            .build(),
        androidBuilder
            .setClassName("SingleLaunchActivityTestCase")
            .setExtendsClass("android.test.InstrumentationTestCase")
            .clearMethods()
            .addMethod(
                methodBuilder
                    .setMethodName("testActivityTestCaseSetUpProperly")
                    .build())
            .build(),
        androidBuilder
            .setClassName("SyncBaseInstrumentation")
            .setExtendsClass("android.test.InstrumentationTestCase")
            .clearMethods()
            .build());

    return baseClasses.iterator();

  }