Bus { Set<Class<?>> flattenHierarchy(Class<?> concreteClass) { Set<Class<?>> classes = flattenHierarchyCache.get(concreteClass); if (classes == null) { Set<Class<?>> classesCreation = getClassesFor(concreteClass); classes = flattenHierarchyCache.putIfAbsent(concreteClass, classesCreation); if (classes == null) { classes = classesCreation; } } return classes; } Bus();  Bus(String identifier);  Bus(ThreadEnforcer enforcer);  Bus(ThreadEnforcer enforcer, String identifier);   Bus(ThreadEnforcer enforcer, String identifier, HandlerFinder handlerFinder); @Override String toString(); void register(Object object); void unregister(Object object); void post(Object event); static final String DEFAULT_IDENTIFIER; }
@Test public void flattenHierarchy() { HierarchyFixture fixture = new HierarchyFixture(); Set<Class<?>> hierarchy = bus.flattenHierarchy(fixture.getClass()); assertEquals(3, hierarchy.size()); assertContains(Object.class, hierarchy); assertContains(HierarchyFixtureParent.class, hierarchy); assertContains(HierarchyFixture.class, hierarchy); }