According to this answer an int constant is implicitly converted to short type.
But in my unit test I want to test a getValue() function which returns a Short.
assertEquals(obj.getValue(), 42);
Obviously the above doesn't work, so I attempt to use Short.valueOf
assertEquals(obj.getValue(), Short.valueOf(42));
Yet, this still complains - despite the aforementioned implicit conversion - so I have to cast the literal.
assertEquals(obj.getValue(), Short.valueOf((short)42));
Short.valueOf((short)5) seems a bit messy! Is there a cleaner way? ( new Short("42") equally horrible! )