JUnit tests for POJOs

后端 未结 17 1973
Happy的楠姐
Happy的楠姐 2021-02-02 07:56

I work on a project where we have to create unit tests for all of our simple beans (POJOs). Is there any point to creating a unit test for POJOs if all they consist of is gette

17条回答
  •  爱一瞬间的悲伤
    2021-02-02 08:22

    I just started a project to do this. its in pre-alpha stage right now. It is an Eclipse plugin.

    While I agree that typically a POJO setter/getter doesn't necessarily need a test, I believe it is nice to have the simple test there because as things change over time, it will make it easier for you to add more tests for the POJO's. The Unit test is set up, the methods are there to test the setter/getter, all you have to do is handle the new complexity.

    This also helps with the code-coverage reports, which, helps keep managers happy. (My company uses Emma).

    https://sourceforge.net/projects/unittestgplugin/

提交回复
热议问题