Android PointF constructor not working in JUnit test

前端 未结 2 1984
面向向阳花
面向向阳花 2021-01-18 04:46

I have just stumbled on this while trying to write a JUnit test. Admittedly this is my first unit test in JUnit, but I do find the behaviour very puzzling.

p         


        
2条回答
  •  有刺的猬
    2021-01-18 05:06

    I was really surprised that some classes do behave like this in JUnit tests. I don't see any good reason for this in case of a simple DTO class like Point, but rather consider this as a nasty Easter egg which makes programmers' life harder. I would accept that methods like Draw etc. are mocked, as they can be heavily hardware-dependent, but such DTO's should not be mocked.

    I'm still learning Android development, but the more such things I see the more I'm convinced that it is not a mature and well-thought framework.

提交回复
热议问题