Replace many Work and VoidWork usages with lambdas

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176153460
This commit is contained in:
mcilwain 2017-11-17 13:38:53 -08:00 committed by jianglai
parent 603e0470cc
commit cd314bdc75
36 changed files with 443 additions and 680 deletions

View file

@ -21,7 +21,6 @@ import static org.joda.time.DateTimeZone.UTC;
import com.google.common.collect.ImmutableMap;
import com.googlecode.objectify.Key;
import com.googlecode.objectify.VoidWork;
import google.registry.model.tmch.ClaimsListShard.ClaimsListRevision;
import google.registry.model.tmch.ClaimsListShard.UnshardedSaveException;
import google.registry.testing.AppEngineRule;
@ -60,15 +59,15 @@ public class ClaimsListShardTest {
@Test
public void test_unshardedSaveFails() throws Exception {
thrown.expect(UnshardedSaveException.class);
ofy().transact(new VoidWork() {
@Override
public void vrun() {
ClaimsListShard claimsList =
ClaimsListShard.create(ofy().getTransactionTime(), ImmutableMap.of("a", "b"));
claimsList.id = 1; // Without an id this won't save anyways.
claimsList.parent = ClaimsListRevision.createKey();
ofy().saveWithoutBackup().entity(claimsList).now();
}});
ofy()
.transact(
() -> {
ClaimsListShard claimsList =
ClaimsListShard.create(ofy().getTransactionTime(), ImmutableMap.of("a", "b"));
claimsList.id = 1; // Without an id this won't save anyways.
claimsList.parent = ClaimsListRevision.createKey();
ofy().saveWithoutBackup().entity(claimsList).now();
});
}
@Test