Skip to content

Instantly share code, notes, and snippets.

@stickfigure
Created May 15, 2014 16:56
Show Gist options
  • Save stickfigure/773cb8cbb54b6121ff25 to your computer and use it in GitHub Desktop.
Save stickfigure/773cb8cbb54b6121ff25 to your computer and use it in GitHub Desktop.
Show that missing data is ignored
/**
* Tests of what happens when some data is missing in the db
*
* @author Jeff Schnitzer <[email protected]>
*/
public class MissingDataTests extends TestBase
{
@com.googlecode.objectify.annotation.Entity
static class Foo {
@Id
Long id;
String bar = "bar";
}
@Test
public void missingDataIsIgnored() throws Exception {
fact().register(Foo.class);
DatastoreService ds = ds();
Entity ent = new Entity(Key.getKind(Foo.class));
ds.put(null, ent);
Key<Foo> key = Key.create(ent.getKey());
Foo fetched = ofy().load().key(key).now();
assert "bar".equals(fetched.bar);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment