title: Unit Testing a GPS detecting method
body: <p>I really need help with unit testing a method. I simply don't really understand how to go about it. This method is called when pressing a navigation button that centers on your location on my android app. Let's call it buttnav.</p>
  
  <pre><code>public void GPSDetector() { 
      AlertDialog.Builder build = new AlertDialog.Builder(
              mapFragment.getActivity());
      build
              .setTitle("GPS Detection Services")
              .setMessage("GPS is disabled in your device. Enable it?")
              .setCancelable(false)
              .setPositiveButton("Enable GPS",
                      new DialogInterface.OnClickListener() {
                          public void onClick(DialogInterface dialog, int which) {
                              Intent i = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
                              startActivity(i);
                          }
                      });
      build.setNegativeButton("Cancel",
              new DialogInterface.OnClickListener() {
                  public void onClick(DialogInterface dialog, int id) {
                      dialog.cancel();
                  }
              });
      AlertDialog alert = build.create();
      alert.show();
  }
  </code></pre>
  
  <p>Map fragment being an entity instantiated as a SupportMapFragment on onActivityCreated inside of a fragment as such:</p>
  
  <pre><code>mapFragment = (SupportMapFragment) getChildFragmentManager()
              .findFragmentById(R.id.map);
  </code></pre>
  
  <p>I'm pretty lost and couldn't find much documentation referring to unit testing within Android core functionality. I'm trying to use Junit. I tried espresso but it doesn't encompass Android core functionality views.</p>