package de.christinecoenen.code.zapp.app.mediathek.ui.detail;

import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;

import androidx.test.core.app.ActivityScenario;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.platform.app.InstrumentationRegistry;

import org.junit.Test;
import org.junit.runner.RunWith;

import de.christinecoenen.code.zapp.app.mediathek.MediathekData;

@RunWith(AndroidJUnit4.class)
public class MediathekPlayerActivityTest {

	@Test
	public void testRecreation() {
		Context context = InstrumentationRegistry.getInstrumentation().getTargetContext();
		Intent intent = MediathekPlayerActivity.getStartIntent(context, MediathekData.getTestShow());

		ActivityScenario scenario = ActivityScenario.launch(intent);
		scenario.recreate();

		scenario.onActivity(activity -> activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE));
		scenario.recreate();
	}

}

@@ -56,16 +56,45 @@
 etail;%0A%0A
+import android.app.Activity;%0A
 import a
@@ -351,16 +351,41 @@
 istry;%0A%0A
+import org.junit.Before;%0A
 import o
@@ -433,16 +433,73 @@
 nWith;%0A%0A
+import de.christinecoenen.code.zapp.app.ZappApplication;%0A
 import d
@@ -559,81 +559,534 @@
 ta;%0A
-%0A@RunWith(AndroidJUnit4.class)%0Apublic class MediathekPlayerActivityTest %7B
+import de.christinecoenen.code.zapp.app.mediathek.model.PersistedMediathekShow;%0A%0A@RunWith(AndroidJUnit4.class)%0Apublic class MediathekPlayerActivityTest %7B%0A%0A%09private PersistedMediathekShow persistedShow;%0A%0A%09@Before%0A%09public void Setup() %7B%0A%09%09ZappApplication zappApplication = (ZappApplication) InstrumentationRegistry%0A%09%09%09.getInstrumentation()%0A%09%09%09.getTargetContext()%0A%09%09%09.getApplicationContext();%0A%0A%09%09persistedShow = zappApplication.getMediathekRepository()%0A%09%09%09.persistOrUpdateShow(MediathekData.getTestShow())%0A%09%09%09.blockingFirst();%0A%09%7D
 %0A%0A%09@
@@ -1277,33 +1277,27 @@
 xt, 
-MediathekData.getTestShow
+persistedShow.getId
 ());
@@ -1316,16 +1316,26 @@
 Scenario
+%3CActivity%3E
  scenari

Fix ui test with compiler error