title: Testing file creation in Robolectric
body: <p>I am tryingto wite a test in robolectric on android. basically I have a class that writes serialized objects to a file. I pass in a context to the constructor and use that to call the method <code>getFilesDir()</code></p>
  
  <pre><code>new File(context.getFilesDir(), filename); 
  </code></pre>
  
  <p>I pass in <code>RuntimeEnvironment.application</code> as the context when testing but I get an assert failed when I call the below method to test if the file exists.</p>
  
  <pre><code>@Override
  public boolean fileExists() {
  
      return context.getFileStreamPath(filename).exists();
  } 
  </code></pre>
  
  <p>I was wondering is there another way of going about this and using the test context to create the file. Thanks in advance!</p>
  
  <p>here is the simple test iam running</p>
  
  <pre><code>@Test
  public void testFileCreated()
  {
      objmodelroom.createFile();
      assertTrue(objmodelroom.fileExists());
  }
  </code></pre>
  
  <p>i create the file like this</p>
  
  <pre><code>public void createFile()
  {
      this.objectfile = new File(context.getFilesDir(), filename);
      objectfile.setReadable(true);
      objectfile.setWritable(true);
  }
  </code></pre>