### Question:
EntityTypeFactory { public static <E> EntityType<E> getEntityType(Class<E> entityClass, ClassHelper classHelper) { if (entityClass == null) { throw new DomaNullPointerException("entityClass"); } if (classHelper == null) { throw new DomaNullPointerException("classHelper"); } if (!entityClass.isAnnotationPresent(Entity.class)) { throw new DomaIllegalArgumentException( "entityClass", Message.DOMA2206.getMessage("entityClass")); } String entityTypeClassName = ClassNames.newEntityTypeClassName(entityClass.getName()).toString(); try { Class<E> clazz = classHelper.forName(entityTypeClassName); Method method = ClassUtil.getMethod(clazz, "getSingletonInternal"); return MethodUtil.invoke(method, null); } catch (Exception e) { throw new EntityTypeNotFoundException( e.getCause(), entityClass.getName(), entityTypeClassName); } }  static EntityType<E> getEntityType(Class<E> entityClass, ClassHelper classHelper);  }### Answer:
@Test public void testGetEntityType() { EntityType<Emp> type = EntityTypeFactory.getEntityType(Emp.class, classHelper); assertNotNull(type); }
@Test public void testGetEntityType_forNestedEntity() { EntityType<NotTopLevelEntity.Hoge> type = EntityTypeFactory.getEntityType(NotTopLevelEntity.Hoge.class, classHelper); assertNotNull(type); }
@Test public void testGetEntityType_DomaIllegalArgumentException() { try { EntityTypeFactory.getEntityType(Object.class, classHelper); fail(); } catch (DomaIllegalArgumentException e) { System.out.println(e.getMessage()); } }
@Test public void testGetEntityType_EntityTypeNotFoundException() { try { EntityTypeFactory.getEntityType(Dept.class, classHelper); fail(); } catch (EntityTypeNotFoundException e) { System.out.println(e.getMessage()); } }