Skip to content

Instantly share code, notes, and snippets.

@ashigeru
Created June 14, 2010 10:10
Show Gist options
  • Save ashigeru/437515 to your computer and use it in GitHub Desktop.
Save ashigeru/437515 to your computer and use it in GitHub Desktop.
import static org.junit.Assert.*;
import org.junit.Test;
import org.slim3.tester.AppEngineTestCase;
import com.google.appengine.api.datastore.Entity;
public class HasParentButIsIncomplete extends AppEngineTestCase {
@Test
public void counter_example() {
Entity parent = new Entity("Hoge", "parent");
Entity child = new Entity("Hoge", parent.getKey());
Hoge model = HogeMeta.get().entityToModel(child);
assertNotNull(model.key);
assertNotNull(model.key.getParent());
assertFalse(model.key.isComplete());
}
}
import org.slim3.datastore.Attribute;
import org.slim3.datastore.Model;
import com.google.appengine.api.datastore.Key;
@Model
public class Hoge {
@Attribute(primaryKey = true)
public Key key;
public Key getKey() {
return this.key;
}
public void setKey(Key key) {
this.key = key;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment