
org.robolectric.shadows.ShadowBackgroundThread Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of framework Show documentation
Show all versions of framework Show documentation
An alternative Android testing framework.
The newest version!
package org.robolectric.shadows;
import android.os.Build;
import com.android.internal.os.BackgroundThread;
import org.robolectric.annotation.Implements;
import org.robolectric.annotation.Resetter;
import org.robolectric.util.ReflectionHelpers;
import static android.os.Build.VERSION_CODES.KITKAT;
@Implements(value = BackgroundThread.class, isInAndroidSdk = false, inheritImplementationMethods = true, minSdk = KITKAT)
public class ShadowBackgroundThread {
@Resetter
public static void reset() {
BackgroundThread instance = ReflectionHelpers.getStaticField(BackgroundThread.class, "sInstance");
if (instance != null) {
instance.quit();
ReflectionHelpers.setStaticField(BackgroundThread.class, "sInstance", null);
ReflectionHelpers.setStaticField(BackgroundThread.class, "sHandler", null);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy