Created
June 14, 2010 10:10
-
-
Save ashigeru/437515 to your computer and use it in GitHub Desktop.
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
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()); | |
} | |
} |
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
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