### Question:
BeanFactoryHelper { public <T> Map<String, String> getAliases(ListableBeanFactory beanFactory, Class<T> clazz) { return beanFactory.getBeansOfType(clazz).keySet().stream() .map(name -> getAliasEntrySet(beanFactory, name)) .flatMap(Collection::stream) .collect(toMap(Map.Entry::getKey, Map.Entry::getValue)); }  static BeanFactoryHelper getInstance(); Map<String, T> collectToOrderedMap(ListableBeanFactory beanFactory, Class<T> clazz, List<T> orderedBeans); Map<String, String> getAliases(ListableBeanFactory beanFactory, Class<T> clazz);  }### Answer:
@Test public void getAliases() { Map<String, String> aliases = beanFactoryHelper.getAliases(applicationContext, Printer.class); assertThat(aliases.entrySet(), hasSize(6)); assertThat(aliases.get("zero1"), is("zero")); assertThat(aliases.get("zero2"), is("zero")); assertThat(aliases.get("one1"), is("one")); assertThat(aliases.get("one2"), is("one")); assertThat(aliases.get("two1"), is("two")); assertThat(aliases.get("two2"), is("two")); }