@Override protected List<Trip> doInBackground(Void... params) { TripStore store=TripDatabase.get(app).tripStore(); List<Trip> result=store.selectAll(); if (result==null || result.size()==0) { store.insert(new Trip("Vacation!", 10080, Priority.MEDIUM, new Date()), new Trip("Business Trip", 4320, Priority.OMG, new Date())); result=store.selectAll(); } return(result); }
@Override protected List<Trip> doInBackground(Void... params) { TripStore store=TripDatabase.get(app).tripStore(); List<Trip> result=store.selectAll(); if (result==null || result.size()==0) { store.insert(new Trip("Vacation!", 10080), new Trip("Business Trip", 4320)); result=store.selectAll(); } return(result); }
private void assertTrip(TripStore store, Trip trip) { List<Trip> results=store.selectAll(); assertNotNull(results); assertEquals(1, results.size()); assertTrue(areIdentical(trip, results.get(0))); Trip result=store.findById(trip.id); assertNotNull(result); assertTrue(areIdentical(trip, result)); }
private void assertTrip(TripStore store, Trip trip) { List<Trip> results=store.selectAll(); assertNotNull(results); assertEquals(1, results.size()); assertTrue(areIdentical(trip, results.get(0))); Trip result=store.findById(trip.id); assertNotNull(result); assertTrue(areIdentical(trip, result)); }
}).when(store).selectAll();
@Test public void basics() { assertEquals(0, store.selectAll().size()); final Trip first=new Trip("Foo", 2880, Priority.LOW, new Date()); assertNotNull(first.id); assertNotEquals(0, first.id.length()); store.insert(first); assertTrip(store, first); final Trip updated= new Trip(first.id, "Foo!!!", 1440, Priority.MEDIUM, first.startTime, first.creationTime, first.updateTime); store.update(updated); assertTrip(store, updated); store.delete(updated); assertEquals(0, store.selectAll().size()); }
@Test public void basics() { assertEquals(0, store.selectAll().size()); final Trip first=new Trip("Foo", 2880, Priority.LOW, new Date()); assertNotNull(first.id); assertNotEquals(0, first.id.length()); store.insert(first); assertTrip(store, first); final Trip updated= new Trip(first.id, "Foo!!!", 1440, Priority.MEDIUM, first.startTime, first.creationTime, first.updateTime); store.update(updated); assertTrip(store, updated); store.delete(updated); assertEquals(0, store.selectAll().size()); }
@Test public void basics() { assertEquals(0, store.selectAll().size()); final Trip first=new Trip("Foo", 2880); assertNotNull(first.id); assertNotEquals(0, first.id.length()); store.insert(first); assertTrip(store, first); final Trip updated=new Trip(first.id, "Foo!!!", 1440); store.update(updated); assertTrip(store, updated); store.delete(updated); assertEquals(0, store.selectAll().size()); }
}).when(store).selectAll();
@Test public void basics() { assertEquals(0, store.selectAll().size()); final Trip first=new Trip("Foo", 2880); assertNotNull(first.id); assertNotEquals(0, first.id.length()); store.insert(first); assertTrip(store, first); final Trip updated=new Trip(first.id, "Foo!!!", 1440); store.update(updated); assertTrip(store, updated); store.delete(updated); assertEquals(0, store.selectAll().size()); }
private void assertTrip(TripStore store, Trip trip) { List<Trip> results=store.selectAll(); assertNotNull(results); assertEquals(1, results.size()); assertTrue(areIdentical(trip, results.get(0))); Trip result=store.findById(trip.id); assertNotNull(result); assertTrue(areIdentical(trip, result)); }
private void assertTrip(TripStore store, Trip trip) { List<Trip> results=store.selectAll(); assertNotNull(results); assertEquals(1, results.size()); assertTrue(areIdentical(trip, results.get(0))); Trip result=store.findById(trip.id); assertNotNull(result); assertTrue(areIdentical(trip, result)); }