### Question:
MockClassResolver extends InstantiationAwareBeanPostProcessorAdapter { @Override public Class<?> predictBeanType(Class<?> beanClass, String beanName) { final DoubleSearch mockSearch = doubleRegistry.mockSearch(); if(mockSearch.containsExactlyOneDouble(beanName)) { final DoubleDefinition definition = mockSearch.findOneDefinition(beanName); return definition.getDoubleClass(); } return NOT_PREDICTABLE; } MockClassResolver(DoubleRegistry doubleRegistry); @Override Class<?> predictBeanType(Class<?> beanClass, String beanName); static final String BEAN_NAME; }### Answer:
@Test public void should_resolve_bean_class_for_mocked_bean() { final MockClassResolver mockClassResolver = createClassResolver(doubleDefinition(MockClass.class, beanName)); assertEquals( MockClass.class, mockClassResolver.predictBeanType(ANY_CLASS, beanName)); }
@Test public void should_return_not_predictable_type_when_mock_does_not_exists_in_double_registry() { final MockClassResolver mockClassResolver = createClassResolver(doubleDefinition(OtherMockClass.class)); assertEquals( null, mockClassResolver.predictBeanType(ANY_CLASS, beanName)); }