Java – How to test a class full of constants

cjavatestingunit testing

There is a class in my project which is just constants as follows:

public class AppConstants
{
  public static String Foo = "Foo";
  public static String Bar = "Bar";
  // so on...
}

Ok these can be marked readonly/final etc.

How can i test this class or make it testable? same idea for a Enum ?

I dont see anything to test but for the sake of testability how can i improve it?

Best Answer

What is there to test? So you have a class full of public, static variables (those are not constant, regardless of the name of the class)... there is no logic here. As long as the compiler knows how to generate valid bytecode (it does) and as long as the CLR knows how to interpret said bytecode (it does), there is no problem.