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

Commit dc634b9b authored by Luca Zuccarini's avatar Luca Zuccarini
Browse files

Revert "Fix @Test annotation to make Kotlin 2.2 happy."

This reverts commit 28b943f0.

Reason for revert: b/438184175 - the '=' notation breaks presubmits when used with `assertThrows` as a top-level call, because it is not a void function

Bug: 427745324
Change-Id: I42e0526e47674b6b249a4fbb558fc4c742e34b90
parent 28b943f0
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -60,7 +60,6 @@ import com.android.wm.shell.windowdecor.common.WindowDecorTaskResourceLoader
import com.google.common.truth.Truth.assertThat
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.MainCoroutineDispatcher
import org.junit.Assert.assertThrows
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
@@ -712,7 +711,7 @@ class DesktopTilingWindowDecorationTest : ShellTestCase() {

    // Construction of a tiling divider with null config expects a null pointer here
    // which is a sign a new divider is being created due to dpi changes.
    @Test
    @Test(expected = NullPointerException::class)
    fun tilingDividerDestroyed_whenDpiChanges() {
        val task1 = createVisibleTask()
        val additionalTaskHelper: DesktopTilingWindowDecoration.AppResizingHelper = mock()
@@ -737,9 +736,9 @@ class DesktopTilingWindowDecorationTest : ShellTestCase() {

        tilingDecoration.leftTaskResizingHelper = tiledTaskHelper
        tilingDecoration.desktopTilingDividerWindowManager = desktopTilingDividerWindowManager
        assertThrows(NullPointerException::class.java) {
        tilingDecoration.onDensityOrFontScaleChanged()
        }

        verify(desktopTilingDividerWindowManager, times(1)).release()
    }

    @Test
+4 −8
Original line number Diff line number Diff line
@@ -40,7 +40,6 @@ import kotlinx.coroutines.test.advanceTimeBy
import kotlinx.coroutines.test.currentTime
import kotlinx.coroutines.test.runCurrent
import kotlinx.coroutines.test.runTest
import org.junit.Assert
import org.junit.Test
import org.junit.runner.RunWith

@@ -99,15 +98,12 @@ class AuthenticationInteractorTest : SysuiTestCase() {
            assertFailed(underTest.authenticate(listOf(9, 8, 7, 6, 5, 4)))
        }

    @Test
    @Test(expected = IllegalArgumentException::class)
    fun authenticate_withEmptyPin_throwsException() =
        Assert.assertThrows(IllegalArgumentException::class.java) {
        testScope.runTest {
            kosmos.fakeAuthenticationRepository.setAuthenticationMethod(Pin)
                
            underTest.authenticate(listOf())
        }
        }

    @Test
    fun authenticate_withCorrectMaxLengthPin_succeeds() =
+3 −7
Original line number Diff line number Diff line
@@ -26,8 +26,6 @@ import com.android.systemui.testKosmos
import com.google.common.truth.Truth.assertThat
import kotlinx.coroutines.test.UnconfinedTestDispatcher
import kotlinx.coroutines.test.runTest
import org.junit.Assert
import org.junit.Assert.assertThrows
import org.junit.Before
import org.junit.Rule
import org.junit.Test
@@ -160,16 +158,14 @@ class DeviceItemActionInteractorTest : SysuiTestCase() {
        }
    }

    @Test
    @Test(expected = IllegalArgumentException::class)
    fun onActionIconClick_audioSharingDeviceType_throwException() {
        with(kosmos) {
            assertThrows(IllegalArgumentException::class.java) {
            testScope.runTest {
                actionInteractorImpl.onActionIconClick(audioSharingDeviceItem) {}
            }
        }
    }
    }

    private companion object {
        const val DEVICE_NAME = "device"
+4 −9
Original line number Diff line number Diff line
@@ -21,8 +21,6 @@ import com.google.common.truth.Truth.assertThat
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.cancel
import kotlinx.coroutines.test.runTest
import org.junit.Assert
import org.junit.Assert.assertThrows
import org.junit.Test
import org.junit.runner.RunWith

@@ -45,11 +43,8 @@ class CoroutineResultTest : SysuiTestCase() {
        assertThat(actual.exceptionOrNull()).isInstanceOf(Exception::class.java)
    }

    @Test
    fun suspendRunCatching_whenCancelled_shouldResumeWithException() =
        assertThrows(IllegalArgumentException::class.java) {
            runTest {
    @Test(expected = CancellationException::class)
    fun suspendRunCatching_whenCancelled_shouldResumeWithException() = runTest {
        suspendRunCatching { cancel() }
    }
}
}
+7 −15
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@ import com.google.common.truth.Truth.assertThat
import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.runCurrent
import kotlinx.coroutines.test.runTest
import org.junit.Assert
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
@@ -508,26 +507,19 @@ class ResizeableItemFrameViewModelTest : SysuiTestCase() {
            assertThat(resizeInfo).isNull()
        }

    @Test
    @Test(expected = IllegalArgumentException::class)
    fun testIllegalState_maxHeightLessThanMinHeight() =
        Assert.assertThrows(IllegalArgumentException::class.java) {
        testScope.runTest {
            updateGridLayout(singleSpanGrid.copy(maxHeightPx = 50, minHeightPx = 100))
        }
        }

    @Test
    @Test(expected = IllegalArgumentException::class)
    fun testIllegalState_currentSpanExceedsTotalSpans() =
        Assert.assertThrows(IllegalArgumentException::class.java) {
            testScope.runTest {
                updateGridLayout(singleSpanGrid.copy(currentSpan = 3, totalSpans = 2)) }
        }
        testScope.runTest { updateGridLayout(singleSpanGrid.copy(currentSpan = 3, totalSpans = 2)) }

    @Test
    @Test(expected = IllegalArgumentException::class)
    fun testIllegalState_resizeMultipleZeroOrNegative() =
        Assert.assertThrows(IllegalArgumentException::class.java) {
        testScope.runTest { updateGridLayout(singleSpanGrid.copy(resizeMultiple = 0)) }
        }

    @Test
    fun testZeroHeights_cannotResize() =
Loading