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

Commit 1f13c158 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Clean up ravenwood mockito support." into main

parents 8548ab0d 450f9f38
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -203,7 +203,6 @@ android_ravenwood_test {
        "androidx.test.uiautomator_uiautomator",
        "compatibility-device-util-axt",
        "flag-junit",
        "mockito_ravenwood",
        "platform-test-annotations",
        "flag-junit",
        "testng",
+0 −1
Original line number Diff line number Diff line
@@ -60,7 +60,6 @@ android_ravenwood_test {
    static_libs: [
        "androidx.annotation_annotation",
        "androidx.test.rules",
        "mockito_ravenwood",
        "frameworks-base-testutils",
        "servicestests-utils",
    ],
+0 −24
Original line number Diff line number Diff line
# Ravenwood and Mockito

Last update: 2023-11-13

- As of 2023-11-13, `external/mockito` is based on version 2.x.
- Mockito didn't support static mocking before 3.4.0.
  See: https://javadoc.io/doc/org.mockito/mockito-core/latest/org/mockito/Mockito.html#48

- Latest Mockito is 5.*. According to https://github.com/mockito/mockito:
  `Mockito 3 does not introduce any breaking API changes, but now requires Java 8 over Java 6 for Mockito 2. Mockito 4 removes deprecated API. Mockito 5 switches the default mockmaker to mockito-inline, and now requires Java 11.`

- Mockito now supports Android natively.
  See: https://javadoc.io/doc/org.mockito/mockito-core/latest/org/mockito/Mockito.html#0.1
  - But it's unclear at this point to omakoto@ how the `mockito-android` module is built.

- Potential plan:
  - Ideal option:
    - If we can update `external/mockito`, that'd be great, but it may not work because
      Mockito has removed the deprecated APIs.
  - Second option:
    - Import the latest mockito as `external/mockito-new`, and require ravenwood
      to use this one.
    - The latest mockito needs be exposed to all of 1) device tests, 2) host tests, and 3) ravenwood tests.
    - This probably will require the latest `bytebuddy` and `objenesis`.
 No newline at end of file
+18 −0
Original line number Diff line number Diff line
#!/bin/bash
# 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.

# List all the ravenwood test modules.

jq -r 'to_entries[] | select( .value.compatibility_suites | index("ravenwood-tests") ) | .key' "$OUT/module-info.json"
+0 −12
Original line number Diff line number Diff line
@@ -7,16 +7,6 @@ package {
    default_applicable_licenses: ["frameworks_base_license"],
}

// Ravenwood tests run on the hostside, so we need mockit of the host variant.
// But we need to use it in modules of the android variant, so we "wash" the variant with it.
java_host_for_device {
    name: "mockito_ravenwood",
    libs: [
        "mockito",
        "objenesis",
    ],
}

android_ravenwood_test {
    name: "RavenwoodMockitoTest",

@@ -26,8 +16,6 @@ android_ravenwood_test {
    static_libs: [
        "junit",
        "truth",

        "mockito_ravenwood",
    ],
    libs: [
        "android.test.mock",
Loading