private void instantiatePageObjectIfNotAssigned(Field pageObjectField, Object target) {
try {
pageObjectField.setAccessible(true);
if (pageObjectField.get(target) == null) {
Class<PageObject> pageObjectClass = (Class<PageObject>) pageObjectField.getType();
PageObject newPageObject = pages.getPage(pageObjectClass);
injectDependenciesInto(newPageObject);
pageObjectField.set(target, newPageObject);
}
} catch (IllegalAccessException e) {
throw new IllegalArgumentException("Could not instanciate page objects in " + target);