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

Commit fa50a345 authored by Daichi Hirono's avatar Daichi Hirono
Browse files

Replace assertThat(v).isNotNull with assertNotNull

assertNotNull is better because it lets the compiler know the value is
not null after the function call.

Bug: None
Test: None
Flag: TEST_ONLY
Change-Id: Idb61d47c9fd2c69422a04abdb01261e83b213397
parent 0733b2e9
Loading
Loading
Loading
Loading
+28 −36
Original line number Diff line number Diff line
@@ -1753,12 +1753,12 @@ class DesktopTasksControllerTest : ShellTestCase() {

        controller.moveToNextDisplay(task.taskId)

        with(getLatestWct(type = TRANSIT_CHANGE)) {
        val wallpaperChange =
                hierarchyOps.find { op -> op.container == wallpaperToken.asBinder() }
            assertThat(wallpaperChange).isNotNull()
            assertThat(wallpaperChange!!.type).isEqualTo(HIERARCHY_OP_TYPE_REMOVE_TASK)
            getLatestWct(type = TRANSIT_CHANGE).hierarchyOps.find { op ->
                op.container == wallpaperToken.asBinder()
            }
        assertNotNull(wallpaperChange)
        assertThat(wallpaperChange.type).isEqualTo(HIERARCHY_OP_TYPE_REMOVE_TASK)
    }

    @Test
@@ -1788,16 +1788,14 @@ class DesktopTasksControllerTest : ShellTestCase() {

        controller.moveToNextDisplay(task.taskId)

        with(getLatestWct(type = TRANSIT_CHANGE)) {
            val taskChange = changes[task.token.asBinder()]
            assertThat(taskChange).isNotNull()
        val taskChange = getLatestWct(type = TRANSIT_CHANGE).changes[task.token.asBinder()]
        assertNotNull(taskChange)
        // To preserve DP size, pixel size is changed to 320x240. The ratio of the left margin
        // to the right margin and the ratio of the top margin to bottom margin are also
        // preserved.
            assertThat(taskChange!!.configuration.windowConfiguration.bounds)
        assertThat(taskChange.configuration.windowConfiguration.bounds)
            .isEqualTo(Rect(240, 160, 560, 400))
    }
    }

    @Test
    @EnableFlags(FLAG_ENABLE_MOVE_TO_NEXT_DISPLAY_SHORTCUT)
@@ -1827,13 +1825,11 @@ class DesktopTasksControllerTest : ShellTestCase() {

        controller.moveToNextDisplay(task.taskId)

        with(getLatestWct(type = TRANSIT_CHANGE)) {
            val taskChange = changes[task.token.asBinder()]
            assertThat(taskChange).isNotNull()
            assertThat(taskChange!!.configuration.windowConfiguration.bounds)
        val taskChange = getLatestWct(type = TRANSIT_CHANGE).changes[task.token.asBinder()]
        assertNotNull(taskChange)
        assertThat(taskChange.configuration.windowConfiguration.bounds)
            .isEqualTo(Rect(960, 480, 1280, 720))
    }
    }

    @Test
    @EnableFlags(FLAG_ENABLE_MOVE_TO_NEXT_DISPLAY_SHORTCUT)
@@ -1860,14 +1856,12 @@ class DesktopTasksControllerTest : ShellTestCase() {

        controller.moveToNextDisplay(task.taskId)

        with(getLatestWct(type = TRANSIT_CHANGE)) {
            val taskChange = changes[task.token.asBinder()]
            assertThat(taskChange).isNotNull()
        val taskChange = getLatestWct(type = TRANSIT_CHANGE).changes[task.token.asBinder()]
        assertNotNull(taskChange)
        // DP size is preserved. The window is centered in the destination display.
            assertThat(taskChange!!.configuration.windowConfiguration.bounds)
        assertThat(taskChange.configuration.windowConfiguration.bounds)
            .isEqualTo(Rect(320, 120, 960, 600))
    }
    }

    @Test
    @EnableFlags(FLAG_ENABLE_MOVE_TO_NEXT_DISPLAY_SHORTCUT)
@@ -1899,15 +1893,13 @@ class DesktopTasksControllerTest : ShellTestCase() {

        controller.moveToNextDisplay(task.taskId)

        with(getLatestWct(type = TRANSIT_CHANGE)) {
            val taskChange = changes[task.token.asBinder()]
            assertThat(taskChange).isNotNull()
            assertThat(taskChange!!.configuration.windowConfiguration.bounds.left).isAtLeast(0)
        val taskChange = getLatestWct(type = TRANSIT_CHANGE).changes[task.token.asBinder()]
        assertNotNull(taskChange)
        assertThat(taskChange.configuration.windowConfiguration.bounds.left).isAtLeast(0)
        assertThat(taskChange.configuration.windowConfiguration.bounds.top).isAtLeast(0)
        assertThat(taskChange.configuration.windowConfiguration.bounds.right).isAtMost(640)
        assertThat(taskChange.configuration.windowConfiguration.bounds.bottom).isAtMost(480)
    }
    }

    @Test
    @EnableFlags(