title: Robolectric: Testing with ormlite
body: <p>I'm trying to test ORMLite DAOs with robolectric, but database behaviour is not the same as when it's used from my android app. My DAOs are working perfectly well on the android application.</p>
  
  <p>Reading about robolectric shadows and debugging code, I encountered <a href="http://pivotal.github.com/robolectric/javadoc/com/xtremelabs/robolectric/shadows/ShadowSQLiteOpenHelper.html" rel="nofollow">ShadowSQLiteOpenHelper</a> (code <a href="http://grepcode.com/file/repo1.maven.org/maven2/com.pivotallabs/robolectric/1.1/com/xtremelabs/robolectric/shadows/ShadowSQLiteOpenHelper.java?av=f" rel="nofollow">here</a>).</p>
  
  <p><em>Does anyone know if this Shadow is enough to test ormlite daos? Or I have to create my own shadow to achieve that? Any clue/tip/suggestion/example here?</em></p>
  
  <p>Thanks in advance.</p>
  
  <hr>
  
  <p>Extra info:</p>
  
  <p>Test method:</p>
  
  <pre><code>@Test
  public void basicTest() throws SQLException {
      assertNotNull(randomStringResource); // Injection of an android resource: OK
      assertThat(randomStringResource, equalTo("Event")); // With correct value: OK
      assertNotNull(eventDao); // Dao injection: OK
      assertThat(eventDao.countOf(), equalTo(0L)); // Table empty: OK
  
      Event e1 = new Event("e1", new Date());
      eventDao.create(e1);
  
      assertNotNull(e1.getId()); // ID generated by OrmLite: OK
      assertThat(eventDao.countOf(), equalTo(1L)); // Table not empty: OK
      assertThat("e1", equalTo(eventDao.queryForId(e1.getId()).getName())); // Query for inserted event: Throws exception
  }
  </code></pre>
  
  <p>Some of the problems encountered running this test:</p>
  
  <ul>
  <li>Errors querying entities with "camelCased" property names: error thrown at last line of test (<a href="https://groups.google.com/d/topic/ormlite-android/QnOB8S5xQqo/discussion" rel="nofollow">related problem</a>). Never had a problem like this running the android app.</li>
  <li>When I changed one of these properties name (e.g., <code>isEnabled</code> to <code>enabled</code>) in order to avoid the camelCase problem, the previous error persisted... seems like memory database didn't apply the changes that I made on the entity.</li>
  </ul>
  
  <p>Versions used:</p>
  
  <ul>
  <li>Robolectric 1.1</li>
  <li>OrmLite 4.41</li>
  </ul>