From 38c823a042ee3ca880b15d79095087a89d66f627 Mon Sep 17 00:00:00 2001 From: TwoAi Date: Sat, 10 Aug 2024 15:42:35 -0400 Subject: [PATCH] Remove outdated returnActivity test code returnActivity was removed in 463dd8e --- .../schabi/newpipe/error/ErrorActivity.java | 22 ------------ .../newpipe/error/ErrorActivityTest.java | 35 ------------------- 2 files changed, 57 deletions(-) delete mode 100644 app/src/test/java/org/schabi/newpipe/error/ErrorActivityTest.java diff --git a/app/src/main/java/org/schabi/newpipe/error/ErrorActivity.java b/app/src/main/java/org/schabi/newpipe/error/ErrorActivity.java index 831a8cc4b..2f607b487 100644 --- a/app/src/main/java/org/schabi/newpipe/error/ErrorActivity.java +++ b/app/src/main/java/org/schabi/newpipe/error/ErrorActivity.java @@ -2,7 +2,6 @@ package org.schabi.newpipe.error; import static org.schabi.newpipe.util.Localization.assureCorrectAppLanguage; -import android.app.Activity; import android.content.Context; import android.content.Intent; import android.net.Uri; @@ -13,7 +12,6 @@ import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; -import androidx.annotation.Nullable; import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; @@ -22,7 +20,6 @@ import androidx.core.content.IntentCompat; import com.grack.nanojson.JsonWriter; import org.schabi.newpipe.BuildConfig; -import org.schabi.newpipe.MainActivity; import org.schabi.newpipe.R; import org.schabi.newpipe.databinding.ActivityErrorBinding; import org.schabi.newpipe.util.Localization; @@ -187,25 +184,6 @@ public class ErrorActivity extends AppCompatActivity { .collect(Collectors.joining(separator + "\n", separator + "\n", separator)); } - /** - * Get the checked activity. - * - * @param returnActivity the activity to return to - * @return the casted return activity or null - */ - @Nullable - static Class getReturnActivity(final Class returnActivity) { - Class checkedReturnActivity = null; - if (returnActivity != null) { - if (Activity.class.isAssignableFrom(returnActivity)) { - checkedReturnActivity = returnActivity.asSubclass(Activity.class); - } else { - checkedReturnActivity = MainActivity.class; - } - } - return checkedReturnActivity; - } - private void buildInfo(final ErrorInfo info) { String text = ""; diff --git a/app/src/test/java/org/schabi/newpipe/error/ErrorActivityTest.java b/app/src/test/java/org/schabi/newpipe/error/ErrorActivityTest.java deleted file mode 100644 index f77c7b268..000000000 --- a/app/src/test/java/org/schabi/newpipe/error/ErrorActivityTest.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.schabi.newpipe.error; - -import android.app.Activity; - -import org.junit.Test; -import org.schabi.newpipe.MainActivity; -import org.schabi.newpipe.RouterActivity; -import org.schabi.newpipe.fragments.detail.VideoDetailFragment; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -/** - * Unit tests for {@link ErrorActivity}. - */ -public class ErrorActivityTest { - @Test - public void getReturnActivity() { - Class returnActivity; - returnActivity = ErrorActivity.getReturnActivity(MainActivity.class); - assertEquals(MainActivity.class, returnActivity); - - returnActivity = ErrorActivity.getReturnActivity(RouterActivity.class); - assertEquals(RouterActivity.class, returnActivity); - - returnActivity = ErrorActivity.getReturnActivity(null); - assertNull(returnActivity); - - returnActivity = ErrorActivity.getReturnActivity(Integer.class); - assertEquals(MainActivity.class, returnActivity); - - returnActivity = ErrorActivity.getReturnActivity(VideoDetailFragment.class); - assertEquals(MainActivity.class, returnActivity); - } -}