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

Commit f1d3ae09 authored by Beverly's avatar Beverly Committed by Beverly Tai
Browse files

Add null-check for test variables in tearDown (@After)

In case the setup (@Before) never was able to fully run.
This can occur if there was an error in the setup.
Add this null check so that the NPE doesn't obscure the actual
root cause of the test failure.

Test: atest KeyguardIndicationTextViewTest
Test: atest KeyguardClockPositionAlgorithmTest
Fixes: 408471732
Fixes: 408470808
Flag: EXEMPT bugfix
Change-Id: I03da9238e30127451ff9891c62edaf651e4bbc6a
parent 52f8f787
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -49,8 +49,10 @@ public class KeyguardIndicationTextViewTest extends SysuiTestCase {

    @After
    public void tearDown() {
        if (mKeyguardIndicationTextView != null) {
            mKeyguardIndicationTextView.setAnimationsEnabled(true);
        }
    }

    @Test
    public void switchIndication_null_hideIndication() {
+5 −1
Original line number Diff line number Diff line
@@ -82,9 +82,13 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {

    @After
    public void tearDown() {

        if (mStaticMockSession != null) {
            mStaticMockSession.finishMocking();
        }

    }

    @Test
    public void notifPositionTopOfScreenOnAOD() {
        // GIVEN on AOD and clock has 0 height