Skip to content

Commit

Permalink
Fix Oppia Test Rule imports in few utility modules
Browse files Browse the repository at this point in the history
Needs //testing dependency and throws Fingerprint issues without RunWith AndroidJunit4 class.
  • Loading branch information
Rd4dev committed Jan 6, 2025
1 parent 59db0bd commit 2ddadb5
Show file tree
Hide file tree
Showing 14 changed files with 18 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -781,10 +781,7 @@ class ProfileAndDeviceIdFragmentTest {
}
}

// req learner study analytics + log learner study id
@Test
/*@EnableFeatureFlag("android_enable_logging_learner_study_ids")
@EnableFeatureFlag("android_enable_learner_study_analytics")*/
fun testFragment_multipleProfiles_clickShareIdsAndLogs_sendsIntentWithIdsAndLogsText() {
// Use fake time so that the generated event logs are consistent across runs.
fakeOppiaClock.setFakeTimeMode(FakeOppiaClock.FakeTimeMode.MODE_FIXED_FAKE_TIME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ import org.oppia.android.scripts.todo.model.Todo

/** Tests for [TodoCollector]. */
class TodoCollectorTest {
@get:Rule
val oppiaTestRule = OppiaTestRule()

@field:[Rule JvmField] val tempFolder = TemporaryFolder()

@Before
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ import javax.inject.Singleton
@LooperMode(LooperMode.Mode.PAUSED)
@Config(application = SyncStatusManagerImplTest.TestApplication::class)
class SyncStatusManagerImplTest : SyncStatusManagerTestBase() {
@get:Rule
val oppiaTestRule = OppiaTestRule()

@Inject override lateinit var impl: SyncStatusManager
@Inject override lateinit var monitorFactory: DataProviderTestMonitor.Factory
@Inject override lateinit var persistentCacheStoreFactory: PersistentCacheStore.Factory
Expand Down
10 changes: 10 additions & 0 deletions utility/src/test/java/org/oppia/android/util/math/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ oppia_android_test(
test_manifest = "//utility:test_manifest",
deps = [
"//model/src/main/proto:math_java_proto_lite",
"//testing",
"//testing/src/main/java/org/oppia/android/testing/math:math_equation_subject",
"//third_party:androidx_test_ext_junit",
"//third_party:com_google_truth_extensions_truth-liteproto-extension",
Expand All @@ -31,6 +32,7 @@ oppia_android_test(
test_manifest = "//utility:test_manifest",
deps = [
"//model/src/main/proto:math_java_proto_lite",
"//testing",
"//testing/src/main/java/org/oppia/android/testing/math:math_expression_subject",
"//third_party:androidx_test_ext_junit",
"//third_party:com_google_truth_extensions_truth-liteproto-extension",
Expand All @@ -50,6 +52,7 @@ oppia_android_test(
test_manifest = "//utility:test_manifest",
deps = [
"//model/src/main/proto:math_java_proto_lite",
"//testing",
"//third_party:androidx_test_ext_junit",
"//third_party:com_google_truth_truth",
"//third_party:junit_junit",
Expand All @@ -68,6 +71,7 @@ oppia_android_test(
test_manifest = "//utility:test_manifest",
deps = [
"//model/src/main/proto:test_models",
"//testing",
"//third_party:androidx_test_ext_junit",
"//third_party:com_google_truth_truth",
"//third_party:junit_junit",
Expand Down Expand Up @@ -105,6 +109,7 @@ oppia_android_test(
test_manifest = "//utility:test_manifest",
deps = [
"//model/src/main/proto:math_java_proto_lite",
"//testing",
"//third_party:androidx_test_ext_junit",
"//third_party:com_google_truth_extensions_truth-liteproto-extension",
"//third_party:com_google_truth_truth",
Expand All @@ -124,6 +129,7 @@ oppia_android_test(
test_manifest = "//utility:test_manifest",
deps = [
"//model/src/main/proto:math_java_proto_lite",
"//testing",
"//testing/src/main/java/org/oppia/android/testing/math:polynomial_subject",
"//third_party:androidx_test_ext_junit",
"//third_party:com_google_truth_truth",
Expand All @@ -142,6 +148,7 @@ oppia_android_test(
test_manifest = "//utility:test_manifest",
deps = [
"//model/src/main/proto:math_java_proto_lite",
"//testing",
"//third_party:androidx_test_ext_junit",
"//third_party:com_google_truth_truth",
"//third_party:junit_junit",
Expand Down Expand Up @@ -258,6 +265,7 @@ oppia_android_test(
test_manifest = "//utility:test_manifest",
deps = [
"//model/src/main/proto:math_java_proto_lite",
"//testing",
"//testing:assertion_helpers",
"//testing/src/main/java/org/oppia/android/testing/math:real_subject",
"//third_party:androidx_test_ext_junit",
Expand All @@ -277,6 +285,7 @@ oppia_android_test(
test_manifest = "//utility:test_manifest",
deps = [
"//model/src/main/proto:math_java_proto_lite",
"//testing",
"//testing/src/main/java/org/oppia/android/testing/math:math_expression_subject",
"//third_party:androidx_test_ext_junit",
"//third_party:com_google_truth_extensions_truth-liteproto-extension",
Expand Down Expand Up @@ -333,6 +342,7 @@ oppia_android_test(
test_manifest = "//utility:test_manifest",
deps = [
"//model/src/main/proto:math_java_proto_lite",
"//testing",
"//third_party:androidx_test_ext_junit",
"//third_party:com_google_truth_truth",
"//third_party:junit_junit",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ import org.robolectric.annotation.LooperMode
@SelectRunnerPlatform(ParameterizedJunitTestRunner::class)
@LooperMode(LooperMode.Mode.PAUSED)
class ExpressionToComparableOperationConverterTest {
@get:Rule
val oppiaTestRule = OppiaTestRule()

@Parameter lateinit var op1: String
@Parameter lateinit var op2: String

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ import org.robolectric.annotation.LooperMode
@LooperMode(LooperMode.Mode.PAUSED)
@Config
class FractionParserTest {
@get:Rule
val oppiaTestRule = OppiaTestRule()

private lateinit var fractionParser: FractionParser

@Before
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ import org.robolectric.annotation.LooperMode
@SelectRunnerPlatform(ParameterizedJunitTestRunner::class)
@LooperMode(LooperMode.Mode.PAUSED)
class MathExpressionExtensionsTest {
@get:Rule
val oppiaTestRule = OppiaTestRule()

@Parameter lateinit var exp1: String
@Parameter lateinit var exp2: String

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ import org.robolectric.annotation.LooperMode
@SelectRunnerPlatform(ParameterizedJunitTestRunner::class)
@LooperMode(LooperMode.Mode.PAUSED)
class MathExpressionParserTest {
@get:Rule
val oppiaTestRule = OppiaTestRule()

@Parameter
lateinit var lhsOp: String
@Parameter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import org.robolectric.annotation.LooperMode
@SelectRunnerPlatform(ParameterizedJunitTestRunner::class)
@LooperMode(LooperMode.Mode.PAUSED)
class MathTokenizerTest {
@get:Rule
val oppiaTestRule = OppiaTestRule()

@Parameter lateinit var variableName: String
@Parameter lateinit var funcName: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,6 @@ class PolynomialExtensionsTest {
)
}

@get:Rule
val oppiaTestRule = OppiaTestRule()

@Parameter lateinit var var1: String
@Parameter lateinit var var2: String
@Parameter lateinit var var3: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@ class RealExtensionsTest {
private val NEGATIVE_PI_REAL = createIrrationalReal(-PI)
}

@get:Rule
val oppiaTestRule = OppiaTestRule()

private val fractionParser by lazy { FractionParser() }

@Parameter var lhsInt: Int = Int.MIN_VALUE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ oppia_android_test(
test_manifest = "//utility:test_manifest",
deps = [
"//:dagger",
"//testing",
"//testing/src/main/java/org/oppia/android/testing/networking:network_connection_test_util",
"//testing/src/main/java/org/oppia/android/testing/robolectric:test_module",
"//testing/src/main/java/org/oppia/android/testing/time:test_module",
Expand All @@ -34,6 +35,7 @@ oppia_android_test(
test_manifest = "//utility:test_manifest",
deps = [
"//:dagger",
"//testing",
"//testing/src/main/java/org/oppia/android/testing/networking:network_connection_test_util",
"//testing/src/main/java/org/oppia/android/testing/robolectric:test_module",
"//testing/src/main/java/org/oppia/android/testing/time:test_module",
Expand All @@ -56,6 +58,7 @@ oppia_android_test(
test_manifest = "//utility:test_manifest",
deps = [
"//:dagger",
"//testing",
"//testing/src/main/java/org/oppia/android/testing/networking:network_connection_test_util",
"//testing/src/main/java/org/oppia/android/testing/robolectric:test_module",
"//testing/src/main/java/org/oppia/android/testing/time:test_module",
Expand All @@ -78,6 +81,7 @@ oppia_android_test(
test_manifest = "//utility:test_manifest",
deps = [
"//:dagger",
"//testing",
"//testing/src/main/java/org/oppia/android/testing/networking:network_connection_test_util",
"//testing/src/main/java/org/oppia/android/testing/robolectric:test_module",
"//testing/src/main/java/org/oppia/android/testing/time:test_module",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ oppia_android_test(
test_class = "org.oppia.android.util.parser.math.MathModelTest",
test_manifest = "//utility:test_manifest",
deps = [
"//testing",
"//third_party:com_google_truth_truth",
"//third_party:junit_junit",
"//third_party:robolectric_android-all",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package org.oppia.android.util.parser.math

import androidx.test.ext.junit.runners.AndroidJUnit4
import com.google.common.truth.Truth.assertThat
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.oppia.android.testing.OppiaTestRule
import java.security.MessageDigest

/** Tests for [MathModel]. */
// FunctionName: test names are conventionally named with underscores.
@RunWith(AndroidJUnit4::class)
@Suppress("FunctionName")
class MathModelTest {
@get:Rule
Expand Down

0 comments on commit 2ddadb5

Please sign in to comment.