SHARE
TWEET

Untitled

a guest Mar 21st, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import static com.google.appengine.api.datastore.FetchOptions.Builder.withLimit;
  2. import static org.junit.Assert.assertEquals;
  3.  
  4. import com.google.appengine.api.datastore.DatastoreService;
  5. import com.google.appengine.api.datastore.DatastoreServiceFactory;
  6. import com.google.appengine.api.datastore.Entity;
  7. import com.google.appengine.api.datastore.Query;
  8. import com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig;
  9. import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
  10. import org.junit.After;
  11. import org.junit.Before;
  12. import org.junit.Test;
  13.  
  14. public class LocalDatastoreTest {
  15.  
  16.   private final LocalServiceTestHelper helper =
  17.       new LocalServiceTestHelper(new LocalDatastoreServiceTestConfig());
  18.  
  19.   @Before
  20.   public void setUp() {
  21.     helper.setUp();
  22.   }
  23.  
  24.   @After
  25.   public void tearDown() {
  26.     helper.tearDown();
  27.   }
  28.  
  29.   private void doTest() {
  30.     DatastoreService ds = DatastoreServiceFactory.getDatastoreService();
  31.     assertEquals(0, ds.prepare(new Query("yam")).countEntities(withLimit(10)));
  32.  
  33.     ds.put(new Entity("hello"));
  34.     ds.put(new Entity("hello"));
  35.     assertEquals(2, ds.prepare(new Query("hello")).countEntities(withLimit(10)));
  36.   }
  37. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top