Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9a045797 authored by Makoto Onuki's avatar Makoto Onuki
Browse files

Delete test validation

Error prone has a check for missing @Test, so we don't need it.

Now that we have Ravenizer that can see all test code at the build time,
we no longer need these checks, at least at runtime. If needed, we can
now detect them at the build time.
Test: build
Bug: 361656170
Flag: EXEMPT host test change only

Change-Id: Ib4b94c3e49b507fefd931bc4bf46b11f4424ed02
parent 920ae6e9
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -51,10 +51,6 @@
      "name": "CtsUtilTestCasesRavenwood",
      "host": true
    },
    {
      "name": "RavenwoodCoreTest",
      "host": true
    },
    {
      "name": "RavenwoodResApkTest",
      "host": true

ravenwood/coretest/Android.bp

deleted100644 → 0
+0 −23
Original line number Diff line number Diff line
package {
    // See: http://go/android-license-faq
    // A large-scale-change added 'default_applicable_licenses' to import
    // all of the 'license_kinds' from "frameworks_base_license"
    // to get the below license kinds:
    //   SPDX-license-identifier-Apache-2.0
    default_applicable_licenses: ["frameworks_base_license"],
}

android_ravenwood_test {
    name: "RavenwoodCoreTest",

    static_libs: [
        "androidx.annotation_annotation",
        "androidx.test.ext.junit",
        "androidx.test.rules",
    ],
    srcs: [
        "test/**/*.java",
    ],
    sdk_version: "test_current",
    auto_gen_config: true,
}

ravenwood/coretest/README.md

deleted100644 → 0
+0 −3
Original line number Diff line number Diff line
# Ravenwood core test

This test contains (non-bivalent) tests for Ravenwood itself -- e.g. tests for the ravenwood rules.
 No newline at end of file
+0 −53
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.android.ravenwoodtest.coretest;

import android.platform.test.ravenwood.RavenwoodRule;

import androidx.test.runner.AndroidJUnit4; // Intentionally use the deprecated one.

import org.junit.Assume;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.rules.RuleChain;
import org.junit.runner.RunWith;

/**
 * Test for the test runner validator in RavenwoodRule.
 */
@RunWith(AndroidJUnit4.class)
public class RavenwoodTestRunnerValidationTest {
    // Note the following rules don't have a @Rule, because they need to be applied in a specific
    // order. So we use a RuleChain instead.
    private ExpectedException mThrown = ExpectedException.none();
    private final RavenwoodRule mRavenwood = new RavenwoodRule();

    @Rule
    public final RuleChain chain = RuleChain.outerRule(mThrown).around(mRavenwood);

    public RavenwoodTestRunnerValidationTest() {
        Assume.assumeTrue(RavenwoodRule._$RavenwoodPrivate.isOptionalValidationEnabled());
        // Because RavenwoodRule will throw this error before executing the test method,
        // we can't do it in the test method itself.
        // So instead, we initialize it here.
        mThrown.expectMessage("Switch to androidx.test.ext.junit.runners.AndroidJUnit4");
    }

    @Test
    public void testValidateTestRunner() {
    }
}
+0 −51
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.android.ravenwoodtest.coretest.methodvalidation;

import android.platform.test.ravenwood.RavenwoodRule;

import androidx.test.runner.AndroidJUnit4;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.rules.RuleChain;
import org.junit.runner.RunWith;

/**
 * RavenwoodRule has a validator to ensure "test-looking" methods have valid JUnit annotations.
 * This class contains tests for this validator.
 */
@RunWith(AndroidJUnit4.class)
public class RavenwoodTestMethodValidation_Fail01_Test {
    private ExpectedException mThrown = ExpectedException.none();
    private final RavenwoodRule mRavenwood = new RavenwoodRule();

    @Rule
    public final RuleChain chain = RuleChain.outerRule(mThrown).around(mRavenwood);

    public RavenwoodTestMethodValidation_Fail01_Test() {
        mThrown.expectMessage("Method setUp() doesn't have @Before");
    }

    @SuppressWarnings("JUnit4SetUpNotRun")
    public void setUp() {
    }

    @Test
    public void testEmpty() {
    }
}
Loading