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

Commit ebac5056 authored by Winson's avatar Winson
Browse files

Move MockitoUtils to server om package

This should definitely be in a shared utility module, but
because of transitive dependencies, adding Mockito to test-utils
isn't that simple.

For now, move it to the overlay package, to be cleaned up
in a later CL.

Bug: 146004674

Test: atest com.android.server.om

Change-Id: I585df0da0f44433d13fb32397d13ad2ad7b5d50c
parent 2fdaf81c
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
 * limitations under the License.
 */

package test.util
package com.android.server.om

import org.mockito.Answers
import org.mockito.Mockito
@@ -22,6 +22,8 @@ import org.mockito.invocation.InvocationOnMock
import org.mockito.stubbing.Answer
import org.mockito.stubbing.Stubber

// TODO(chiuwinson): Move this entire file to a shared utility module
// TODO(b/135203078): De-dupe utils added for overlays vs package refactor
object MockitoUtils {
    val ANSWER_THROWS = Answer<Any?> {
        when (val name = it.method.name) {
+0 −2
Original line number Diff line number Diff line
@@ -24,8 +24,6 @@ import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized
import org.testng.Assert.assertThrows
import test.util.mockThrowOnUnmocked
import test.util.whenever

@RunWith(Parameterized::class)
class OverlayReferenceMapperTests {
+1 −6
Original line number Diff line number Diff line
@@ -17,16 +17,11 @@
java_library {
    name: "frameworks-base-testutils",

    srcs: [
        "java/**/*.java",
        "java/**/*.kt",
    ],
    srcs: ["java/**/*.java"],

    static_libs: [
        "junit",
        "hamcrest-library",
        "truth-prebuilt",
        "mockito-target-minus-junit4",
    ],

    libs: [
+0 −21
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 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.
 */

/**
 * This package separated from android. because placing classes under android.'s .test/.util
 * may be confused with tests for that actual android subpackage.
 **/
package test;