public void testFindById(boolean useSameEm)
{
EntityManager em = emf.createEntityManager();
StudentMongoBytePrimitive studentMax = em.find(StudentMongoBytePrimitive.class, getMaxValue(byte.class));
Assert.assertNotNull(studentMax);
Assert.assertEquals(getMaxValue(short.class), studentMax.getAge());
Assert.assertEquals(getMaxValue(String.class), studentMax.getName());
if (!useSameEm)
{
em.close();
em = emf.createEntityManager();
}
StudentMongoBytePrimitive studentMin = em.find(StudentMongoBytePrimitive.class, getMinValue(byte.class));
Assert.assertNotNull(studentMin);
Assert.assertEquals(getMinValue(short.class), studentMin.getAge());
Assert.assertEquals(getMinValue(String.class), studentMin.getName());
if (!useSameEm)
{
em.close();
em = emf.createEntityManager();
}
StudentMongoBytePrimitive student = em.find(StudentMongoBytePrimitive.class, getRandomValue(byte.class));
Assert.assertNotNull(student);
Assert.assertEquals(getRandomValue(short.class), student.getAge());
Assert.assertEquals(getRandomValue(String.class), student.getName());
em.close();
}