title: Mockito for Environment getExternalStorageState() android
body: <p>I am new to mockito testing, I have been trying to follow the blogs but its pretty jumbled up for now.</p>
  
  <p>The motto is to test two static functions in the <code>FileUtility</code> class. The code goes below.</p>
  
  <pre><code>public static boolean isExternalStorageWritable() {
      String state = Environment.getExternalStorageState();
      if (Environment.MEDIA_MOUNTED.equals(state)) {
          return true;
      }
      return false;
  }
  
  public static String getLogFilePath(String fileName) {
      if (isExternalStorageWritable()) {
          File _file;
          if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.KITKAT) {
              _file = Environment.getExternalStoragePublicDirectory(
                      Environment.DIRECTORY_DOCUMENTS);
              if (exists(_file)) {
                  return getAbsoluteFilePath(_file,fileName);
              }
          }
  
          _file = Environment.getExternalStorageDirectory();
          if (exists(_file)) {
              return getAbsoluteFilePath(_file,fileName);
          }
      }
  
      File _file = Environment.getDataDirectory();
      if (exists(_file)) {
          return getAbsoluteFilePath(_file,fileName);
      }
  
      return fileName;
  }
  
  private static boolean exists(File file) {
      return file != null &amp;&amp; file.exists();
  }
  </code></pre>
  
  <p>How should i write the unit test case to test that function for inputs like "fileName=null"?</p>
  
  <p>Please share some light/code into it.</p>