// Path: crash/app/src/main/java/com/google/samples/quickstart/crash/java/MainActivity.java
// public class MainActivity extends AppCompatActivity {
// 
//     private static final String TAG = "MainActivity";
//     private FirebaseCrashlytics mCrashlytics;
//     private CustomKeySamples samples;
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         final ActivityMainBinding binding = ActivityMainBinding.inflate(getLayoutInflater());
//         setContentView(binding.getRoot());
// 
//         this.samples = new CustomKeySamples(this.getApplicationContext());
//         samples.setSampleCustomKeys();
//         samples.updateAndTrackNetworkState();
// 
//         mCrashlytics = FirebaseCrashlytics.getInstance();
// 
//         // Log the onCreate event, this will also be printed in logcat
//         mCrashlytics.log("onCreate");
// 
//         // Add some custom values and identifiers to be included in crash reports
//         mCrashlytics.setCustomKey("MeaningOfLife", 42);
//         mCrashlytics.setCustomKey("LastUIAction", "Test value");
//         mCrashlytics.setUserId("123456789");
// 
//         // Report a non-fatal exception, for demonstration purposes
//         mCrashlytics.recordException(new Exception("Non-fatal exception: something went wrong!"));
// 
//         // Button that causes NullPointerException to be thrown.
//         binding.crashButton.setOnClickListener(new View.OnClickListener() {
//             @Override
//             public void onClick(View v) {
//                 // Log that crash button was clicked.
//                 mCrashlytics.log("Crash button clicked.");
// 
//                 // If catchCrashCheckBox is checked catch the exception and report it using
//                 // logException(), Otherwise throw the exception and let Crashlytics automatically
//                 // report the crash.
//                 if (binding.catchCrashCheckBox.isChecked()) {
//                     try {
//                         throw new NullPointerException();
//                     } catch (NullPointerException ex) {
//                         // [START crashlytics_log_and_report]
//                         mCrashlytics.log("NPE caught!");
//                         mCrashlytics.recordException(ex);
//                         // [END crashlytics_log_and_report]
//                     }
//                 } else {
//                     throw new NullPointerException();
//                 }
//             }
//         });
// 
//         // Log that the Activity was created.
//         // [START crashlytics_log_event]
//         mCrashlytics.log("Activity created");
//         // [END crashlytics_log_event]
//     }
// 
//     @Override
//     public void onDestroy() {
//         super.onDestroy();
//         samples.stopTrackingNetworkState();
//     }
// }


import androidx.test.espresso.ViewInteraction;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.rule.ActivityTestRule;
import androidx.test.filters.LargeTest;
import android.widget.CheckBox;
import com.google.samples.quickstart.crash.java.MainActivity;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.espresso.matcher.ViewMatchers.withText;
import static org.hamcrest.Matchers.allOf;
package com.google.samples.quickstart.crash;






@LargeTest
@RunWith(AndroidJUnit4.class)
public class MainActivityTest {

    @Rule
// Path: crash/app/src/main/java/com/google/samples/quickstart/crash/java/MainActivity.java
// public class MainActivity extends AppCompatActivity {
// 
//     private static final String TAG = "MainActivity";
//     private FirebaseCrashlytics mCrashlytics;
//     private CustomKeySamples samples;
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         final ActivityMainBinding binding = ActivityMainBinding.inflate(getLayoutInflater());
//         setContentView(binding.getRoot());
// 
//         this.samples = new CustomKeySamples(this.getApplicationContext());
//         samples.setSampleCustomKeys();
//         samples.updateAndTrackNetworkState();
// 
//         mCrashlytics = FirebaseCrashlytics.getInstance();
// 
//         // Log the onCreate event, this will also be printed in logcat
//         mCrashlytics.log("onCreate");
// 
//         // Add some custom values and identifiers to be included in crash reports
//         mCrashlytics.setCustomKey("MeaningOfLife", 42);
//         mCrashlytics.setCustomKey("LastUIAction", "Test value");
//         mCrashlytics.setUserId("123456789");
// 
//         // Report a non-fatal exception, for demonstration purposes
//         mCrashlytics.recordException(new Exception("Non-fatal exception: something went wrong!"));
// 
//         // Button that causes NullPointerException to be thrown.
//         binding.crashButton.setOnClickListener(new View.OnClickListener() {
//             @Override
//             public void onClick(View v) {
//                 // Log that crash button was clicked.
//                 mCrashlytics.log("Crash button clicked.");
// 
//                 // If catchCrashCheckBox is checked catch the exception and report it using
//                 // logException(), Otherwise throw the exception and let Crashlytics automatically
//                 // report the crash.
//                 if (binding.catchCrashCheckBox.isChecked()) {
//                     try {
//                         throw new NullPointerException();
//                     } catch (NullPointerException ex) {
//                         // [START crashlytics_log_and_report]
//                         mCrashlytics.log("NPE caught!");
//                         mCrashlytics.recordException(ex);
//                         // [END crashlytics_log_and_report]
//                     }
//                 } else {
//                     throw new NullPointerException();
//                 }
//             }
//         });
// 
//         // Log that the Activity was created.
//         // [START crashlytics_log_event]
//         mCrashlytics.log("Activity created");
//         // [END crashlytics_log_event]
//     }
// 
//     @Override
//     public void onDestroy() {
//         super.onDestroy();
//         samples.stopTrackingNetworkState();
//     }
// }


// Path: crash/app/src/androidTest/java/com/google/samples/quickstart/crash/MainActivityTest.java
import androidx.test.espresso.ViewInteraction;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.rule.ActivityTestRule;
import androidx.test.filters.LargeTest;
import android.widget.CheckBox;
import com.google.samples.quickstart.crash.java.MainActivity;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.espresso.matcher.ViewMatchers.withText;
import static org.hamcrest.Matchers.allOf;

package com.google.samples.quickstart.crash;






@LargeTest
@RunWith(AndroidJUnit4.class)
public class MainActivityTest {

    @Rule
    public ActivityTestRule<MainActivity> mActivityTestRule = new ActivityTestRule<>(MainActivity.class);