Actually, I kinda found a way to do it, using reflection. Problem that I had was how to set class type for mocking object(it is private class inside another class), so I get declared classes inside the parent class and comparing class names defined the one I needed.
Exactly, it was like this:
The class I tested extends one Spring's class. Concrete problem happened at point when I had to mock line from Spring's parent class super method, which was:
StringValueResolver valueResolver = new PlaceholderResolvingStringValueResolver(props);
inside method "processProperties(ConfigurableListableBeanFactory beanFactoryToProcess, Properties props)" in class "PropertyPlaceholderConfigurer", where "PlaceholderResolvingStringValueResolver" is a private class inside "PropertyPlaceholderConfigurer", so I used next:
Class clazz = Class.forName("org.springframework.beans.factory.config.PropertyPlaceholderConfigurer");
Class privateClazz = null;
for (int i = 0; i < clazz.getDeclaredClasses().length; i++) {
if (clazz.getDeclaredClasses()[i].getName()
.equals("org.springframework.beans.factory.config.PropertyPlaceholderConfigurer$PlaceholderResolvingStringValueResolver")){
privateClazz = clazz.getDeclaredClasses()[i];
break;
}
}
And later I used "privateClazz" to define type in method createMock().
It works for me.
Maybe this is not elegant and the best way to do it, but I didn't find anything other useful.
I hope this helps in some way..
Dusica