vendredi 21 août 2015

How to reflection test entity annotations using JUnit

How can I test the integrity of annotations in Entity generated from Tables in a DB. What I am trying to do is to test if the annotations are there and to check if they are filled out properly such as using Object data types instead of variables Eg.(Integers instead of int). check if Calendar type is used instead of Date type.

Any suggestions would be appreciated.

Currently I can create these tables and manually assign annotations such as: @Entity @Id, @GeneratedValue(), @Column(name="columnName"), @Size(min = 1, max =20, message = "{ClassName.variableName.messageType"}), @NotNull(message = "{ClassName.variableName.messageType"}), @Temporal(TemporalType.DATE)...

The part where I am trying to solve is that i need to check the integrity of thesees annotations, such as if they are filled out properly or even there. the code that i have to be tested is:

Aucun commentaire:

Enregistrer un commentaire