### Question:
MessageToolTranslationMessageParser implements TranslationMessageParser { @Override public TranslationMessage parse(String message) { TranslationMessage translationMessage; if (StringUtils.isEmpty(message)) { translationMessage = TranslationMessage.EMPTY; } else { translationMessage = new MessageFormatTranslationMessage(message, this.plainParser); } return translationMessage; }  @Override TranslationMessage parse(String message); static final String HINT; }### Answer:
@Test public void messageEmpty() throws ComponentLookupException { TranslationMessage translationMessage = getMockedComponent().parse(""); Assert.assertEquals("", translationMessage.getRawSource()); Assert.assertEquals(new CompositeBlock(), translationMessage.render(null, null)); }
@Test public void messageSimple() throws ComponentLookupException { TranslationMessage translationMessage = getMockedComponent().parse("word"); Assert.assertEquals("word", translationMessage.getRawSource()); Assert.assertEquals(new WordBlock("word"), translationMessage.render(null, null)); }
@Test public void messageWithOneParameter() throws ComponentLookupException { TranslationMessage translationMessage = getMockedComponent().parse("{0}"); Assert.assertEquals("{0}", translationMessage.getRawSource()); Assert.assertEquals(new WordBlock("word"), translationMessage.render(null, null, "word")); }
@Test public void messageWithExpectedParameter() throws ComponentLookupException { TranslationMessage translationMessage = getMockedComponent().parse("{0}"); Assert.assertEquals("{0}", translationMessage.getRawSource()); Assert.assertEquals( new CompositeBlock(Arrays.<Block> asList(new SpecialSymbolBlock('{'), new WordBlock("0"), new SpecialSymbolBlock('}'))), translationMessage.render(null, null)); }
@Test public void messageWithApostrophe() throws ComponentLookupException { TranslationMessage translationMessage = getMockedComponent().parse("'"); Assert.assertEquals("'", translationMessage.getRawSource()); Assert.assertEquals(new SpecialSymbolBlock('\''), translationMessage.render(null, null)); }
@Test public void messageWithEscapedParameter() throws ComponentLookupException { TranslationMessage translationMessage = getMockedComponent().parse("'{0}"); Assert.assertEquals("'{0}", translationMessage.getRawSource()); Assert.assertEquals( new CompositeBlock(Arrays.<Block> asList(new SpecialSymbolBlock('{'), new WordBlock("0"), new SpecialSymbolBlock('}'))), translationMessage.render(null, null, "word")); }
@Test public void messageWithChoiceSyntax() throws ComponentLookupException { TranslationMessage translationMessage = getMockedComponent().parse("{0,choice,0#choice1|0<choice2}"); Assert.assertEquals("{0,choice,0#choice1|0<choice2}", translationMessage.getRawSource()); Assert.assertEquals(new WordBlock("choice1"), translationMessage.render(null, null, 0)); Assert.assertEquals(new WordBlock("choice2"), translationMessage.render(null, null, 42)); }