ClassMetaData cmd = repo.getMetaData(AllFieldTypes.class, null, true);
try {
// Don't parameterize this collection to force the JVM to use the
// ...(ClassMetaData meta, Collection<Object> oids) method sig.
Collection ids = new ArrayList<AllFieldTypes>();
ids.add(new AllFieldTypes());
JPAFacadeHelper.toOpenJPAObjectIds(cmd, ids);
fail("Didn't fail!");
} catch (UserException re) {
// expected
}
try {
JPAFacadeHelper.toOpenJPAObjectId(cmd, "a");
fail("Didn't fail!");
} catch (UserException re) {
// expected
}
OpenJPAEntityManagerSPI em = emf.createEntityManager();
em.getTransaction().begin();
AllFieldTypes type = new AllFieldTypes();
em.persist(type);
em.getTransaction().commit();
Object oid = em.getObjectId(type);
assertEquals(Id.class, JPAFacadeHelper.toOpenJPAObjectId(cmd, oid).getClass());
}