void (CellAppearanceEx appearance, SimpleTextAttributes expectedAttribute) { if (appearance instanceof SimpleTextCellAppearance) { assertEquals(expectedAttribute, ((SimpleTextCellAppearance)appearance).getTextAttributes()); } else if (appearance instanceof CompositeAppearance) { Iterator<CompositeAppearance.TextSection> iterator = ((CompositeAppearance)appearance).getSectionsIterator(); CompositeAppearance.TextSection section = iterator.next(); assertEquals(expectedAttribute.toTextAttributes(), section.getTextAttributes()); assertFalse(iterator.hasNext()); } else fail("Unknown class: " + appearance.getClass().getName()); }