It looks like you’ve got a canonical way of getting the “raw” value (toLong
in this case) – so just test that all the constructors are correct when you fetch that value. Then you can test other methods (such as getString()
) based on a single constructor, as you know that once the various constructors have finished, they all leave the object in the same state.
This is assuming somewhat white-box testing – i.e. you know that toLong
is really a simple reflection of the internal state, so it’s okay to test that + a constructor in a test.