Laurent Hinoul

“Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.” - John F. Woods

How to unit test getters and setters in Java

It is possible to test getters and setters (properties) from your model class. Through a test class, it is done in no time.

In the test class of your model class, you add the following code:

ModelClassToTest = your class name you want to test

Download the source code here:

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: