JUnit tests for POJOs

后端 未结 17 1687
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:06

    I once spent two hours because of something like this:

    int getX()
    {
        return (x);
    }
    
    int getY()
    {
        return (x); // oops
    }
    

    Since it takes almost no time to write the tests for simple getters, I do it now out of habit.

提交回复
热议问题