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
if (featureManager.isNewInvoiceEnabled) { | |
// ... | |
if (featureManager.isStripeEnbled) { | |
// Show stripe with new design | |
} else { | |
// Show old payment with new design | |
} | |
// ... |
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
class SplashScreen { | |
private val featureManager: FeatureManager | |
private fun startHomeScreen() { | |
if (featureManager.homeExperiementEnabled) { | |
startActivity(Intent(this, HomeExperimentScreen::class.java)) | |
} else { | |
startActivity(Intent(this, HomeScreen::class.java)) | |
} | |
} |
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
@Test | |
fun testCreateNewRemind() { | |
mockData() | |
launchFragmentInContainer<RemyndDetailsFragment>( | |
factory = factory, | |
themeResId = R.style.AppTheme | |
) | |
onView(withId(R.id.edtTitle)).perform( | |
typeText("Go to school"), |
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
@RunWith(AndroidJUnit4::class) | |
class RemyndDetailsFragmentTest { | |
private lateinit var factory: FragmentFactory | |
private lateinit var db: RemyndDB | |
private lateinit var remyndDao: RemyndDao | |
@Mock | |
private lateinit var scheduler: AlarmScheduler | |
@Before |
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
class MockFragmentFactoryImpl( | |
private val dependency: RemyndDetailsDependency | |
) : FragmentFactory() { | |
override fun instantiate(classLoader: ClassLoader, className: String): Fragment { | |
return when (loadFragmentClass(classLoader, className)) { | |
RemyndDetailsFragment::class.java -> RemyndDetailsFragment(dependency) | |
else -> super.instantiate(classLoader, className) | |
} | |
} |
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
@RemyndDetailsScope | |
@Component(modules = [RemyndDetailsModule::class], dependencies = [RemyndDetailsDependency::class]) | |
internal interface RemyndDetailsComponent { | |
@Component.Factory | |
interface Factory { | |
fun create( | |
@BindsInstance fragment: RemyndDetailsFragment, | |
dependency: RemyndDetailsDependency | |
): RemyndDetailsComponent |
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
class RemyndDetailsFragment(private val dependency: RemyndDetailsDependency) : Fragment() |
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
interface RemyndDetailsDependency { | |
fun remyndDao(): RemyndDao | |
fun resourceProvider(): ResourcesProvider | |
fun alarmScheduler(): AlarmScheduler | |
} |