Skip to content

Commit

Permalink
Added missing OppiaTestRule in every test file
Browse files Browse the repository at this point in the history
The Regex Validation returned around 298 test files with a missing oppia test rule and all these files were now included with the rule irrespective of the feature flag usage.
  • Loading branch information
Rd4dev committed Jan 6, 2025
1 parent 73b4067 commit 59db0bd
Show file tree
Hide file tree
Showing 298 changed files with 1,231 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ import org.oppia.android.domain.platformparameter.PlatformParameterModule
import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule
import org.oppia.android.domain.question.QuestionModule
import org.oppia.android.domain.workmanager.WorkManagerConfigurationModule
import org.oppia.android.testing.OppiaTestRule
import org.oppia.android.testing.TestLogReportingModule
import org.oppia.android.testing.espresso.EditTextInputAction
import org.oppia.android.testing.firebase.TestAuthenticationModule
Expand Down Expand Up @@ -130,6 +131,9 @@ import javax.inject.Singleton
qualifiers = "port-xxhdpi"
)
class MathExpressionInteractionsViewTest {
@get:Rule
val oppiaTestRule = OppiaTestRule()

@get:Rule
val initializeDefaultLocaleRule = InitializeDefaultLocaleRule()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ import org.oppia.android.domain.platformparameter.PlatformParameterModule
import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule
import org.oppia.android.domain.question.QuestionModule
import org.oppia.android.domain.workmanager.WorkManagerConfigurationModule
import org.oppia.android.testing.OppiaTestRule
import org.oppia.android.testing.TestImageLoaderModule
import org.oppia.android.testing.TestLogReportingModule
import org.oppia.android.testing.firebase.TestAuthenticationModule
Expand Down Expand Up @@ -95,6 +96,8 @@ import javax.inject.Singleton
qualifiers = "port-xxhdpi"
)
class AppCompatCheckBoxBindingAdaptersTest {
@get:Rule
val oppiaTestRule = OppiaTestRule()

@get:Rule
val initializeDefaultLocaleRule = InitializeDefaultLocaleRule()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ import org.oppia.android.domain.platformparameter.PlatformParameterModule
import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule
import org.oppia.android.domain.question.QuestionModule
import org.oppia.android.domain.workmanager.WorkManagerConfigurationModule
import org.oppia.android.testing.OppiaTestRule
import org.oppia.android.testing.TestImageLoaderModule
import org.oppia.android.testing.TestLogReportingModule
import org.oppia.android.testing.firebase.TestAuthenticationModule
Expand Down Expand Up @@ -99,6 +100,8 @@ import javax.inject.Singleton
qualifiers = "port-xxhdpi"
)
class DrawableBindingAdaptersTest {
@get:Rule
val oppiaTestRule = OppiaTestRule()

@get:Rule
val initializeDefaultLocaleRule = InitializeDefaultLocaleRule()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import com.google.common.truth.Truth.assertThat
import dagger.Component
import org.junit.After
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.oppia.android.R
Expand Down Expand Up @@ -63,6 +64,7 @@ import org.oppia.android.domain.platformparameter.PlatformParameterModule
import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule
import org.oppia.android.domain.question.QuestionModule
import org.oppia.android.domain.workmanager.WorkManagerConfigurationModule
import org.oppia.android.testing.OppiaTestRule
import org.oppia.android.testing.TestImageLoaderModule
import org.oppia.android.testing.TestLogReportingModule
import org.oppia.android.testing.espresso.EditTextInputAction
Expand Down Expand Up @@ -96,6 +98,9 @@ import javax.inject.Singleton
qualifiers = "port-xxhdpi"
)
class TextInputLayoutBindingAdaptersTest {
@get:Rule
val oppiaTestRule = OppiaTestRule()

@Inject
lateinit var context: Context

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ import org.oppia.android.domain.platformparameter.PlatformParameterModule
import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule
import org.oppia.android.domain.question.QuestionModule
import org.oppia.android.domain.workmanager.WorkManagerConfigurationModule
import org.oppia.android.testing.OppiaTestRule
import org.oppia.android.testing.TestImageLoaderModule
import org.oppia.android.testing.TestLogReportingModule
import org.oppia.android.testing.firebase.TestAuthenticationModule
Expand Down Expand Up @@ -102,6 +103,9 @@ private const val TIMESTAMP = 1556094120000
qualifiers = "port-xxhdpi"
)
class TextViewBindingAdaptersTest {
@get:Rule
val oppiaTestRule = OppiaTestRule()

@get:Rule
val initializeDefaultLocaleRule = InitializeDefaultLocaleRule()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ import org.oppia.android.domain.platformparameter.PlatformParameterModule
import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule
import org.oppia.android.domain.question.QuestionModule
import org.oppia.android.domain.workmanager.WorkManagerConfigurationModule
import org.oppia.android.testing.OppiaTestRule
import org.oppia.android.testing.TestLogReportingModule
import org.oppia.android.testing.firebase.TestAuthenticationModule
import org.oppia.android.testing.junit.InitializeDefaultLocaleRule
Expand Down Expand Up @@ -100,6 +101,9 @@ import javax.inject.Singleton
qualifiers = "port-xxhdpi"
)
class MathExpressionParserActivityTest {
@get:Rule
val oppiaTestRule = OppiaTestRule()

@get:Rule
val initializeDefaultLocaleRule = InitializeDefaultLocaleRule()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ import org.oppia.android.domain.platformparameter.PlatformParameterModule
import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule
import org.oppia.android.domain.question.QuestionModule
import org.oppia.android.domain.workmanager.WorkManagerConfigurationModule
import org.oppia.android.testing.OppiaTestRule
import org.oppia.android.testing.TestImageLoaderModule
import org.oppia.android.testing.TestLogReportingModule
import org.oppia.android.testing.espresso.EditTextInputAction
Expand Down Expand Up @@ -119,6 +120,9 @@ class MathExpressionParserFragmentTest {
)
}

@get:Rule
val oppiaTestRule = OppiaTestRule()

// Note that the locale rule must be initialized first since the scenario rule can depend on the
// locale being initialized.
@get:Rule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModu
import org.oppia.android.domain.question.QuestionModule
import org.oppia.android.domain.workmanager.WorkManagerConfigurationModule
import org.oppia.android.testing.BuildEnvironment
import org.oppia.android.testing.OppiaTestRule
import org.oppia.android.testing.RunOn
import org.oppia.android.testing.TestImageLoaderModule
import org.oppia.android.testing.TestLogReportingModule
Expand Down Expand Up @@ -195,6 +196,9 @@ class HtmlParserTest {
@field:DefaultResourceBucketName
lateinit var resourceBucketName: String

@get:Rule
val oppiaTestRule = OppiaTestRule()

@get:Rule
var activityScenarioRule: ActivityScenarioRule<HtmlParserTestActivity> =
ActivityScenarioRule(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ import org.oppia.android.domain.platformparameter.PlatformParameterModule
import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule
import org.oppia.android.domain.question.QuestionModule
import org.oppia.android.domain.workmanager.WorkManagerConfigurationModule
import org.oppia.android.testing.OppiaTestRule
import org.oppia.android.testing.TestImageLoaderModule
import org.oppia.android.testing.TestLogReportingModule
import org.oppia.android.testing.firebase.TestAuthenticationModule
Expand Down Expand Up @@ -115,6 +116,9 @@ import kotlin.reflect.KClass
qualifiers = "port-xxhdpi"
)
class PoliciesActivityTest {
@get:Rule
val oppiaTestRule = OppiaTestRule()

@get:Rule
val initializeDefaultLocaleRule = InitializeDefaultLocaleRule()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ import org.oppia.android.domain.platformparameter.PlatformParameterModule
import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule
import org.oppia.android.domain.question.QuestionModule
import org.oppia.android.domain.workmanager.WorkManagerConfigurationModule
import org.oppia.android.testing.OppiaTestRule
import org.oppia.android.testing.TestImageLoaderModule
import org.oppia.android.testing.TestLogReportingModule
import org.oppia.android.testing.firebase.TestAuthenticationModule
Expand Down Expand Up @@ -155,6 +156,9 @@ class PoliciesFragmentTest {
@Inject
lateinit var appLanguageLocaleHandler: AppLanguageLocaleHandler

@get:Rule
val oppiaTestRule = OppiaTestRule()

@get:Rule
var activityScenarioRule: ActivityScenarioRule<PoliciesFragmentTestActivity> =
ActivityScenarioRule(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ import com.google.common.truth.Truth.assertThat
import dagger.BindsInstance
import dagger.Component
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mockito.mock
import org.oppia.android.testing.OppiaTestRule
import org.oppia.android.util.accessibility.AccessibilityTestModule
import org.oppia.android.util.accessibility.FakeAccessibilityService
import org.robolectric.annotation.Config
Expand All @@ -23,6 +25,9 @@ import javax.inject.Singleton
@LooperMode(LooperMode.Mode.PAUSED)
@Config(application = FakeAccessibilityServiceTest.TestApplication::class)
class FakeAccessibilityServiceTest {
@get:Rule
val oppiaTestRule = OppiaTestRule()

@Inject
lateinit var accessibilityService: FakeAccessibilityService

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ import org.oppia.android.domain.platformparameter.PlatformParameterModule
import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule
import org.oppia.android.domain.question.QuestionModule
import org.oppia.android.domain.workmanager.WorkManagerConfigurationModule
import org.oppia.android.testing.OppiaTestRule
import org.oppia.android.testing.TestLogReportingModule
import org.oppia.android.testing.firebase.TestAuthenticationModule
import org.oppia.android.testing.junit.InitializeDefaultLocaleRule
Expand Down Expand Up @@ -96,6 +97,9 @@ import javax.inject.Singleton
@LooperMode(LooperMode.Mode.PAUSED)
@Config(application = ActivityIntentFactoriesTest.TestApplication::class)
class ActivityIntentFactoriesTest {
@get:Rule
val oppiaTestRule = OppiaTestRule()

@get:Rule
val initializeDefaultLocaleRule = InitializeDefaultLocaleRule()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ import org.oppia.android.domain.platformparameter.PlatformParameterModule
import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule
import org.oppia.android.domain.question.QuestionModule
import org.oppia.android.domain.workmanager.WorkManagerConfigurationModule
import org.oppia.android.testing.OppiaTestRule
import org.oppia.android.testing.TestLogReportingModule
import org.oppia.android.testing.firebase.TestAuthenticationModule
import org.oppia.android.testing.junit.InitializeDefaultLocaleRule
Expand Down Expand Up @@ -94,6 +95,9 @@ import javax.inject.Singleton
@LooperMode(LooperMode.Mode.PAUSED)
@Config(application = ActivityRouterModuleTest.TestApplication::class)
class ActivityRouterModuleTest {
@get:Rule
val oppiaTestRule = OppiaTestRule()

@get:Rule
val initializeDefaultLocaleRule = InitializeDefaultLocaleRule()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ import org.oppia.android.domain.platformparameter.PlatformParameterModule
import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule
import org.oppia.android.domain.question.QuestionModule
import org.oppia.android.domain.workmanager.WorkManagerConfigurationModule
import org.oppia.android.testing.OppiaTestRule
import org.oppia.android.testing.TestLogReportingModule
import org.oppia.android.testing.firebase.TestAuthenticationModule
import org.oppia.android.testing.junit.InitializeDefaultLocaleRule
Expand Down Expand Up @@ -102,6 +103,9 @@ private const val internalProfileId = 1
@LooperMode(LooperMode.Mode.PAUSED)
@Config(application = ActivityRouterTest.TestApplication::class)
class ActivityRouterTest {
@get:Rule
val oppiaTestRule = OppiaTestRule()

@get:Rule
val initializeDefaultLocaleRule = InitializeDefaultLocaleRule()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ import dagger.Component
import dagger.Module
import dagger.Provides
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.oppia.android.app.model.BuildFlavor
import org.oppia.android.testing.OppiaTestRule
import org.robolectric.annotation.Config
import org.robolectric.annotation.LooperMode
import javax.inject.Inject
Expand All @@ -25,6 +27,9 @@ import javax.inject.Singleton
@LooperMode(LooperMode.Mode.PAUSED)
@Config(application = AlphaBuildFlavorModuleTest.TestApplication::class)
class AlphaBuildFlavorModuleTest {
@get:Rule
val oppiaTestRule = OppiaTestRule()

@Inject
lateinit var buildFlavor: BuildFlavor

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ import dagger.Component
import dagger.Module
import dagger.Provides
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.oppia.android.app.model.BuildFlavor
import org.oppia.android.testing.OppiaTestRule
import org.robolectric.annotation.Config
import org.robolectric.annotation.LooperMode
import javax.inject.Inject
Expand All @@ -25,6 +27,9 @@ import javax.inject.Singleton
@LooperMode(LooperMode.Mode.PAUSED)
@Config(application = BetaBuildFlavorModuleTest.TestApplication::class)
class BetaBuildFlavorModuleTest {
@get:Rule
val oppiaTestRule = OppiaTestRule()

@Inject
lateinit var buildFlavor: BuildFlavor

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ import dagger.Component
import dagger.Module
import dagger.Provides
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.oppia.android.app.model.BuildFlavor
import org.oppia.android.testing.OppiaTestRule
import org.robolectric.annotation.Config
import org.robolectric.annotation.LooperMode
import javax.inject.Inject
Expand All @@ -25,6 +27,9 @@ import javax.inject.Singleton
@LooperMode(LooperMode.Mode.PAUSED)
@Config(application = DeveloperBuildFlavorModuleTest.TestApplication::class)
class DeveloperBuildFlavorModuleTest {
@get:Rule
val oppiaTestRule = OppiaTestRule()

@Inject
lateinit var buildFlavor: BuildFlavor

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ import dagger.Component
import dagger.Module
import dagger.Provides
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.oppia.android.app.model.BuildFlavor
import org.oppia.android.testing.OppiaTestRule
import org.robolectric.annotation.Config
import org.robolectric.annotation.LooperMode
import javax.inject.Inject
Expand All @@ -25,6 +27,9 @@ import javax.inject.Singleton
@LooperMode(LooperMode.Mode.PAUSED)
@Config(application = GaBuildFlavorModuleTest.TestApplication::class)
class GaBuildFlavorModuleTest {
@get:Rule
val oppiaTestRule = OppiaTestRule()

@Inject
lateinit var buildFlavor: BuildFlavor

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ import dagger.Component
import dagger.Module
import dagger.Provides
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.oppia.android.app.model.BuildFlavor
import org.oppia.android.testing.OppiaTestRule
import org.robolectric.annotation.Config
import org.robolectric.annotation.LooperMode
import javax.inject.Inject
Expand All @@ -25,6 +27,9 @@ import javax.inject.Singleton
@LooperMode(LooperMode.Mode.PAUSED)
@Config(application = TestingBuildFlavorModuleTest.TestApplication::class)
class TestingBuildFlavorModuleTest {
@get:Rule
val oppiaTestRule = OppiaTestRule()

@Inject
lateinit var buildFlavor: BuildFlavor

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@ import org.mockito.Mockito.verifyNoMoreInteractions
import org.mockito.junit.MockitoJUnit
import org.mockito.junit.MockitoRule
import org.oppia.android.app.devoptions.RouteToMathExpressionParserTestListener
import org.oppia.android.testing.OppiaTestRule

/** Tests for [DeveloperOptionsTestParsersViewModel]. */
// FunctionName: test names are conventionally named with underscores.
@Suppress("FunctionName")
class DeveloperOptionsTestParsersViewModelTest {
@get:Rule
val oppiaTestRule = OppiaTestRule()

@Rule
@JvmField
val mockitoRule: MockitoRule = MockitoJUnit.rule()
Expand Down
Loading

0 comments on commit 59db0bd

Please sign in to comment.