All,
I have a class file that is used to store all the constants that would be use开发者_运维问答d throughout my application. The class file contains only constants and methods JUnit test case for such a class? If yes, how should I test such a class file?
It doesn't sound like a great idea to keep all the constants for the whole application in a single class to start with. Why separate them from the class which is most closely related to the value? For example, if you have a default timeout for authentication requests, keep it with your authentication service (or whatever).
If you really want to have a class with just constants, I don't think it needs any tests. Tests should exercise logic - constants don't have any logic.
精彩评论