* @author Max Ross <maxr@google.com>
*/
public class JPAEnumTest extends JPATestCase {
public void testRoundtrip() {
HasEnumJPA pojo = new HasEnumJPA();
pojo.setMyEnum(V1);
pojo.setMyEnumArray(new MyEnum[] {V2, V1, V2});
pojo.setMyEnumList(Utils.newArrayList(V1, V2, V1));
beginTxn();
em.persist(pojo);
commitTxn();
beginTxn();
pojo = em.find(HasEnumJPA.class, pojo.getKey());
assertEquals(MyEnum.V1, pojo.getMyEnum());
assertTrue(Arrays.equals(new MyEnum[] {V2, V1, V2 }, pojo.getMyEnumArray()));
assertEquals(Utils.newArrayList(V1, V2, V1), pojo.getMyEnumList());
commitTxn();
}