Merge r9316 into the GWT 2.1 branch. Definitive test for enum properties. git-svn-id: https://google-web-toolkit.googlecode.com/svn/releases/2.1@9317 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/test/com/google/gwt/requestfactory/client/RequestFactoryTest.java b/user/test/com/google/gwt/requestfactory/client/RequestFactoryTest.java index 0eea7a2..ace0f2f 100644 --- a/user/test/com/google/gwt/requestfactory/client/RequestFactoryTest.java +++ b/user/test/com/google/gwt/requestfactory/client/RequestFactoryTest.java
@@ -517,6 +517,41 @@ }); } + /** + * Check default value, a newly-set value, and a null value. + */ + public void testEnumProperty() { + delayTestFinish(DELAY_TEST_FINISH); + simpleFooRequest().findSimpleFooById(999L).fire( + new Receiver<SimpleFooProxy>() { + @Override + public void onSuccess(SimpleFooProxy response) { + assertEquals(SimpleEnum.FOO, response.getEnumField()); + SimpleFooRequest ctx = simpleFooRequest(); + response = ctx.edit(response); + response.setEnumField(SimpleEnum.BAR); + ctx.persistAndReturnSelf().using(response).fire( + new Receiver<SimpleFooProxy>() { + @Override + public void onSuccess(SimpleFooProxy response) { + assertEquals(SimpleEnum.BAR, response.getEnumField()); + SimpleFooRequest ctx = simpleFooRequest(); + response = ctx.edit(response); + response.setEnumField(null); + ctx.persistAndReturnSelf().using(response).fire( + new Receiver<SimpleFooProxy>() { + @Override + public void onSuccess(SimpleFooProxy response) { + assertNull(response.getEnumField()); + finishTestAndReset(); + } + }); + } + }); + } + }); + } + public void testFetchEntity() { delayTestFinish(DELAY_TEST_FINISH); simpleFooRequest().findSimpleFooById(999L).fire(
diff --git a/user/test/com/google/gwt/requestfactory/shared/BaseFooProxy.java b/user/test/com/google/gwt/requestfactory/shared/BaseFooProxy.java index a628bf3..2e98883 100644 --- a/user/test/com/google/gwt/requestfactory/shared/BaseFooProxy.java +++ b/user/test/com/google/gwt/requestfactory/shared/BaseFooProxy.java
@@ -97,6 +97,8 @@ void setDoubleField(Double d); + void setEnumField(SimpleEnum value); + void setFloatField(Float f); void setIntId(Integer intId);