JUnit tests for POJOs

后端 未结 17 1670
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:10

    In my experience, creating unit tests for POJOs with only getters and setters, is just overkill. There are some exceptions, of course, if there is additional logic in the getter/setter like checking for null and doing something special, than I would create a unit test for that.

    Also, if there's a bug in the POJO I'd create a unit test for it so we can prevent it from happening again.

提交回复
热议问题