All,
I have a class file that is used to store all the constants that would be used 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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.