DatabaseClassValidator implements ClassVisitor { void validateViewClass() { validateView = true; validator.validate(); } DatabaseClassValidator(Class<?> entityClass); @Override void visitClass(Class<?> objectClass, String path); @Override void visitField(Field field, String parentPath); @Override void visitEnum(Class<?> enumClass);  }
@Test void viewWithPrimaryKey() { assertThatThrownBy(() -> new DatabaseClassValidator(TestViewWithPrimaryKey.class).validateViewClass()) .isInstanceOf(Error.class) .hasMessageContaining("db view field must not have @PrimaryKey"); }