public void testStableId() {
delayTestFinish(DELAY_TEST_FINISH);
SimpleFooRequest context = simpleFooRequest();
final SimpleFooProxy foo = context.create(SimpleFooProxy.class);
final Object futureId = foo.getId();
assertTrue(((SimpleEntityProxyId<?>) foo.stableId()).isEphemeral());
Request<SimpleFooProxy> fooReq = context.persistAndReturnSelf().using(foo);
final SimpleFooProxy newFoo = context.edit(foo);
assertEquals(futureId, foo.getId());
assertTrue(((SimpleEntityProxyId<?>) foo.stableId()).isEphemeral());
assertEquals(futureId, newFoo.getId());
assertTrue(((SimpleEntityProxyId<?>) newFoo.stableId()).isEphemeral());
newFoo.setUserName("GWT basic user");
fooReq.fire(new Receiver<SimpleFooProxy>() {
@Override
public void onSuccess(SimpleFooProxy response) {
final SimpleFooProxy returned = checkSerialization(response);
assertEquals(futureId, foo.getId());
assertFalse(((SimpleEntityProxyId<?>) foo.stableId()).isEphemeral());
assertEquals(futureId, newFoo.getId());
assertFalse(((SimpleEntityProxyId<?>) newFoo.stableId()).isEphemeral());
assertFalse(((SimpleEntityProxyId<?>) returned.stableId()).isEphemeral());
checkStableIdEquals(foo, returned);
checkStableIdEquals(newFoo, returned);
SimpleFooRequest context = simpleFooRequest();
Request<SimpleFooProxy> editRequest = context.persistAndReturnSelf().using(returned);
final SimpleFooProxy editableFoo = context.edit(returned);
editableFoo.setUserName("GWT power user");
editRequest.fire(new Receiver<SimpleFooProxy>() {
@Override
public void onSuccess(SimpleFooProxy response) {
response = checkSerialization(response);