### Question:
FeignContext extends NamedContextFactory<FeignClientSpecification> { @Nullable public <T> T getInstanceWithoutAncestors(String name, Class<T> type) { try { return BeanFactoryUtils.beanOfType(getContext(name), type); } catch (BeansException ex) { return null; } } FeignContext(); @Nullable T getInstanceWithoutAncestors(String name, Class<T> type); @Nullable Map<String, T> getInstancesWithoutAncestors(String name, Class<T> type);  }### Answer:
@Test public void getInstanceWithoutAncestors_verifyNullForMissing() { AnnotationConfigApplicationContext parent = new AnnotationConfigApplicationContext(); parent.refresh(); FeignContext feignContext = new FeignContext(); feignContext.setApplicationContext(parent); feignContext.setConfigurations(Lists.newArrayList(getSpec("empty", EmptyConfiguration.class))); Logger.Level level = feignContext.getInstanceWithoutAncestors("empty", Logger.Level.class); assertThat(level).as("Logger was not null").isNull(); }
@Test public void getInstanceWithoutAncestors() { AnnotationConfigApplicationContext parent = new AnnotationConfigApplicationContext(); parent.refresh(); FeignContext feignContext = new FeignContext(); feignContext.setApplicationContext(parent); feignContext.setConfigurations(Lists.newArrayList(getSpec("demo", DemoConfiguration.class))); Logger.Level level = feignContext.getInstanceWithoutAncestors("demo", Logger.Level.class); assertThat(level).isEqualTo(Logger.Level.FULL); }