ARTICLE AD BOX
The following code snippet throws a ClassCastException.
I know how to fix it, but I'm disappointed that I have to fix it at all, as the Javadoc seems to indicate this should work. But the implementation tries to cast it to an Array (without checking).
@Test public void testHelloWorldFormat() { MessageFormat fmt = new MessageFormat( "Hello, {0}."); assertThat(fmt.format("world")).isEqualTo("Hello, world."); }I have to write it according to the following, and I don't like it:
@Test public void testHelloWorldFormat() { MessageFormat fmt = new MessageFormat( "Hello, {0}."); assertThat(fmt.format(new String[] { "world" })).isEqualTo("Hello, world."); }What i'd really like to see is a MessageFormat.format(Object ...), but there isn't one?
