Is it good practice to check for annotations using reflection in unit test?

(this post explains WHY I would like to do this: Good templates for the beans modular test form that have annotation-based validation in Spring MVC )

Is it considered good practice to write unit test to just check the configuration / annotations in a field or class? For example, if you have:

@AnnotatedClass
public class MyClass {

@AnnotatedField1
@AnnotatedField2
private string myField;

}

Does it make sense to write a unit test that checks for annotations above?

+5
source share
3 answers

The main answer is: "Yes - great to check annotations in unit tests"

: " ". , " " /.

"" , , , , " ", "" - , "" .

- ( ) - , , , . , , , unit test.

+5

, . . , Java- . DB, JSR, GWT UiFields .. .

+2

? , , , , ? , , .

. .

0

All Articles