}
@Test(groups = "fast")
public void testFormatterSuperclassImplementsInterface() throws Exception {
DefaultFormatterFactory factory = new DefaultFormatterFactory();
factory.init(new DefaultConfiguration());
Locale locale = Locale.getDefault();
Formatter<?> formatter;
// simple test to get formatter for a superclass interface
factory.add(X.class, XFormatter.class);
factory.add(Y.class, YFormatter.class);
factory.add(Z.class, ZFormatter.class);
formatter = factory.getFormatter(SuperclassImplementsX.class, locale, null, null);
Assert.assertEquals(XFormatter.class, formatter.getClass());
formatter = factory.getFormatter(SuperclassImplementsY.class, locale, null, null);
Assert.assertEquals(YFormatter.class, formatter.getClass());
formatter = factory.getFormatter(SuperclassImplementsZ.class, locale, null, null);
Assert.assertEquals(ZFormatter.class, formatter.getClass());
/*
* test that if Z extends Y extends X and Y implements I and a formatter is registered for
* both X and I then the formatter returned for Y and Z is the I formatter
*/
factory = new DefaultFormatterFactory();
factory.init(new DefaultConfiguration());
factory.add(SuperclassImplementsX.class, XFormatter.class); // mapping for base class
factory.add(Y.class, YFormatter.class); // mapping for interface in the middle
formatter = factory.getFormatter(SuperclassImplementsX.class, locale, null, null);