Created
May 15, 2014 16:56
-
-
Save stickfigure/773cb8cbb54b6121ff25 to your computer and use it in GitHub Desktop.
Show that missing data is ignored
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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