Created
December 19, 2013 21:42
-
-
Save izmajlowiczl/8046721 to your computer and use it in GitHub Desktop.
Custom RobolectricTestRunner with method for attaching fragments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.app.Fragment; | |
import android.app.FragmentManager; | |
import android.app.FragmentTransaction; | |
import org.junit.runners.model.InitializationError; | |
import org.robolectric.RobolectricTestRunner; | |
/** | |
* Customized test runner based on {@link org.robolectric.RobolectricTestRunner}. | |
* | |
* Creator: <lukasz.izmajlowicz@mydriver.com> | |
* Date: 19/12/13 | |
*/ | |
public class TasksTestRunner extends RobolectricTestRunner { | |
public TasksTestRunner(Class<?> testClass) throws InitializationError { | |
super(testClass); | |
} | |
public static void attachFragment(Fragment fragment, FragmentManager fragmentManager) { | |
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); | |
fragmentTransaction.add(fragment, null); | |
fragmentTransaction.commit(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment