Created
May 14, 2010 04:34
-
-
Save shin1ogawa/400814 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 java.util.ArrayList; | |
import java.util.Collection; | |
import java.util.HashSet; | |
import java.util.List; | |
import org.junit.After; | |
import org.junit.Before; | |
import org.junit.Test; | |
import org.slim3.datastore.Datastore; | |
import chapter5.RemoteApiHelper; | |
import com.shin1ogawa.meta.Slim3ModelMeta; | |
import com.shin1ogawa.model.Slim3Model; | |
public class BlueberryTest { | |
@Test | |
public void set() { | |
test(new HashSet<Integer>()); | |
} | |
@Test | |
public void list() { | |
test(new ArrayList<Integer>()); | |
} | |
void test(Collection<Integer> ids) { | |
Slim3Model model = new Slim3Model(); | |
model.setId(10); | |
Datastore.put(model); | |
Slim3ModelMeta meta = Slim3ModelMeta.get(); | |
ids.add(20); | |
ids.add(15); | |
ids.add(10); | |
List<Slim3Model> list = Datastore.query(meta).filter(meta.id.in(ids)) | |
.asList(); | |
for (Slim3Model m : list) { | |
System.out.println(m.getKey()); | |
} | |
assertEquals(1, list.size()); | |
} | |
RemoteApiHelper helper; | |
@Before | |
public void setUp() throws Exception { | |
helper = RemoteApiHelper.setUp(); | |
helper.startMakeSyncCallServletDelegate(); | |
helper.dropKinds("Slim3Model"); | |
} | |
@After | |
public void tearDown() { | |
helper.endMakeSyncCallServletDelegate(); | |
RemoteApiHelper.tearDown(helper); | |
} | |
// | |
// AppEngineTester tester; | |
// | |
// @Before | |
// public void setUp() throws Exception { | |
// tester = new AppEngineTester(); | |
// tester.setUp(); | |
// } | |
// | |
// @After | |
// public void tearDown() throws Exception { | |
// tester.tearDown(); | |
// } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment