DebugAppCheckTestHelper

class DebugAppCheckTestHelper


Helper class for using DebugAppCheckProviderFactory in integration tests.

Example Usage:

@RunWith(AndroidJunit4.class) public class MyTests {  private final DebugAppCheckTestHelper debugAppCheckTestHelper =  DebugAppCheckTestHelper.fromInstrumentationArgs();  @Test  public void testWithDefaultApp() {  debugAppCheckTestHelper.withDebugProvider(() -> {  // Test code that requires a debug AppCheckToken  });  }  @Test  public void testWithNonDefaultApp() {  debugAppCheckTestHelper.withDebugProvider(  FirebaseApp.getInstance("nonDefaultApp"),  () -> {  // Test code that requires a debug AppCheckToken  });  } }
// In build.gradle.kts android {  defaultConfig {  System.getenv("FIREBASE_APP_CHECK_DEBUG_SECRET")?.let { token ->  testInstrumentationRunnerArguments(  mapOf("firebaseAppCheckDebugSecret" to token))  }  } }

Summary

Public functions

java-static DebugAppCheckTestHelper

Creates a DebugAppCheckTestHelper instance with a debug secret obtained from InstrumentationRegistry arguments.

Unit

Installs a DebugAppCheckProviderFactory to the default FirebaseApp and runs the test code in runnable.

Unit
<E : Throwable?> withDebugProvider(
    firebaseApp: FirebaseApp,
    runnable: DebugAppCheckTestHelper.MaybeThrowingRunnable<E!>
)

Installs a DebugAppCheckProviderFactory to the provided FirebaseApp and runs the test code in runnable.

Public functions

fromInstrumentationArgs

java-static fun fromInstrumentationArgs(): DebugAppCheckTestHelper

Creates a DebugAppCheckTestHelper instance with a debug secret obtained from InstrumentationRegistry arguments.

withDebugProvider

fun <E : Throwable?> withDebugProvider(
    runnable: DebugAppCheckTestHelper.MaybeThrowingRunnable<E!>
): Unit

Installs a DebugAppCheckProviderFactory to the default FirebaseApp and runs the test code in runnable.

Throws
com.google.firebase.appcheck.debug.testing.DebugAppCheckTestHelper: com.google.firebase.appcheck.debug.testing.DebugAppCheckTestHelper

withDebugProvider

fun <E : Throwable?> withDebugProvider(
    firebaseApp: FirebaseApp,
    runnable: DebugAppCheckTestHelper.MaybeThrowingRunnable<E!>
): Unit

Installs a DebugAppCheckProviderFactory to the provided FirebaseApp and runs the test code in runnable.

Throws
com.google.firebase.appcheck.debug.testing.DebugAppCheckTestHelper: com.google.firebase.appcheck.debug.testing.DebugAppCheckTestHelper