### Question:
DeprecatedSyntaxConverter extends AbstractConverter { @Override public Object convert(Type targetType, Object sourceValue) { return this.converter.convert(targetType, sourceValue); }  @Override Object convert(Type targetType, Object sourceValue);  }### Answer:
@Test public void convertToSyntaxObject() throws Exception { Syntax syntax = (Syntax) this.mocker.getComponentUnderTest().convert(Syntax.class, "xwiki/2.1"); Assert.assertEquals(Syntax.XWIKI_2_1, syntax); }
@Test public void convertToSyntaxObjectWhenUnknownSyntax() throws Exception { try { this.mocker.getComponentUnderTest().convert(Syntax.class, "invalid"); Assert.fail("Should have thrown ConversionException"); } catch (ConversionException expected) { Assert.assertEquals("Unknown syntax [invalid]", expected.getMessage()); } }
@Test public void convertToSyntaxObjectWhenNull() throws Exception { Syntax syntax = (Syntax) this.mocker.getComponentUnderTest().convert(Syntax.class, null); Assert.assertNull(syntax); }
@Test public void convertToString() throws Exception { String syntaxId = (String) this.mocker.getComponentUnderTest().convert(String.class, Syntax.XWIKI_2_1); Assert.assertEquals(Syntax.XWIKI_2_1.toIdString(), syntaxId); }
@Test public void convertToStringWhenNull() throws Exception { String syntaxId = (String) this.mocker.getComponentUnderTest().convert(String.class, null); Assert.assertNull(syntaxId); }