Package com.google.appengine.datanucleus.test.jpa

Examples of com.google.appengine.datanucleus.test.jpa.HasEnumJPA


    assertEquals(Utils.newArrayList(V1, V2, V1), pojo.getMyEnumList());
    commitTxn();
  }

  public void testRoundtrip_Null() {
    HasEnumJPA pojo = new HasEnumJPA();
    beginTxn();
    em.persist(pojo);
    commitTxn();

    beginTxn();
    pojo = em.find(HasEnumJPA.class, pojo.getKey());
    assertNull(pojo.getMyEnum());
    assertNull(pojo.getMyEnumArray()); // Never set so should be null
//    assertEquals(0, pojo.getMyEnumArray().length);
    assertNull(pojo.getMyEnumList()); // Never set so should be null
//    assertTrue(pojo.getMyEnumList().isEmpty());
    commitTxn();
  }
View Full Code Here


//    assertTrue(pojo.getMyEnumList().isEmpty());
    commitTxn();
  }

  public void testRoundtrip_NullContainerVals() {
    HasEnumJPA pojo = new HasEnumJPA();
    pojo.setMyEnumArray(new MyEnum[] {null, V2});
    pojo.setMyEnumList(Utils.newArrayList(null, V2));
    beginTxn();
    em.persist(pojo);
    commitTxn();

    beginTxn();
    pojo = em.find(HasEnumJPA.class, pojo.getKey());
    assertNull(pojo.getMyEnum());
    assertTrue(Arrays.equals(new MyEnum[] {null, V2}, pojo.getMyEnumArray()));
    assertEquals(Utils.newArrayList(null, V2), pojo.getMyEnumList());
    commitTxn();
  }
View Full Code Here

* @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();
  }
View Full Code Here

TOP

Related Classes of com.google.appengine.datanucleus.test.jpa.HasEnumJPA

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.