coherence-community / oracle-bedrock

Oracle Bedrock
Other
55 stars 31 forks source link

Allow java.lang.Enum to be used with invoking(...).getEnum() #209

Closed brianoliver closed 9 years ago

brianoliver commented 9 years ago

During testing it was discovered (by Tim Middleton) that it's not easy to use an enumeration with an Eventually.assertThat(). eg:

Eventually.assertThat(invoking(x).getSomeEnum(), is(someEnum));

while it would compile it would throw an exception as the enumeration returned could not be proxied (sub-classed), simply because all enums are final.

In reality we should not attempt to sub-class the enum as it's value is final and hence we can return it directly. ie: as the value is immutable, it isn't going to change and thus a proxy of it wouldn't change either. The solution is to treat them just like we treat other immutable final objects (eg: Strings) and return a dummy value.

brianoliver commented 8 years ago

This issue was imported from JIRA ORACLETOOLS-209

brianoliver commented 9 years ago

Reported by @brianoliver

brianoliver commented 9 years ago

Marked as fixed by @brianoliver on Monday, December 1st 2014, 9:02:44 am