@Test
public void testPut() {
TagDao dao = new TagDao();
Tag tag = new Tag();
tag.setBody("tag body");
tag.setCreatedAt(new Date());
tag.setPhotoKey("photoKey");
tag.setTaggerId("1");
tag.setX(100);
tag.setY(100);
String key = dao.put(tag);
Key rawKey = null;
try {
rawKey = KeyFactory.stringToKey(key);
} catch (NullPointerException e) {
Assert.fail("put() returned null key");
}
try {
Entity entity = datastore.get(rawKey);
assertEquals("body not set", tag.getBody(),
(String) entity.getProperty("body"));
assertEquals("createdAt not set", tag.getCreatedAt(),
(Date) entity.getProperty("createdAt"));
assertEquals("taggerId not set", tag.getTaggerId(),
(String) entity.getProperty("taggerId"));
assertEquals("photoKey not set", tag.getPhotoKey(),
(String) entity.getProperty("photoKey"));
assertEquals("x not set", new Long(100l),
(Long) entity.getProperty("x"));
assertEquals("y not set", new Long(100l),