1
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-11-21 22:10:11 +01:00

Remove outdated returnActivity test code

returnActivity was removed in 463dd8e
This commit is contained in:
TwoAi 2024-08-10 15:42:35 -04:00
parent 51ee2f8d1e
commit 38c823a042
2 changed files with 0 additions and 57 deletions

View File

@ -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<? extends Activity> getReturnActivity(final Class<?> returnActivity) {
Class<? extends Activity> 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 = "";

View File

@ -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<? extends Activity> 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);
}
}