MappedEntity { private void insert(Field field) { Transient ignored = field.getAnnotation(Transient.class); if (ignored != null) { return; } if (this.fields.containsKey(field.getName())) { throw new MorphixEntityException("field name '" + field.getName() + "' already exists"); } if (field.getAnnotation(Id.class) != null) { field.setAccessible(true); this.idField = field; return; } F mapped = getField(field.getAnnotation(Properties.class), field); this.fields.put(field.getName(), mapped); } MappedEntity(T transformer, Class<?> clazz); T getTransformer(); boolean isLifecycle(); boolean isPolymorphic(); Map<String, F> getFields(); Field getIdField(); void map(); void call(LifecycleAction action, Object entity); void set(LifecycleAction action, Object entity, Object value);  }
@Test void insert() { TestTransformer transformer = new TestTransformer(); TestMappedEntity entity = new TestMappedEntity(transformer, BaseEntity.class); entity.map(); TestMappedEntity brokenEntity = new TestMappedEntity(transformer, ChildEntity.class); assertThrows(MorphixEntityException.class, brokenEntity::map); }