Beispiel #1
0
 @SuppressWarnings("unchecked")
 public <T extends AbstractPageObject> T createPage(Class<T> page) throws PageObjectException {
   Constructor<T> cons;
   try {
     cons = page.getConstructor();
     T result = cons.newInstance();
     for (Field field : page.getDeclaredFields()) {
       field.setAccessible(true);
       if (field.getAnnotation(CCProperty.class) != null) {
         AnnotationBuilder.processPropertyField(result, field);
       }
     }
     AspectJProxyFactory proxyFactory = new AspectJProxyFactory(result);
     proxyFactory.addAspect(new PageObjectStateControlAspect(this));
     result = (T) proxyFactory.getProxy();
     return result;
   } catch (Exception e) {
     throw new PageObjectException("Page object creation problem.", e);
   }
 }
 @Before
 public void setUp() throws Exception {
   AspectJProxyFactory proxyFactory = new AspectJProxyFactory(mock(AccountRepository.class));
   proxyFactory.addAspect(RepositoryPerformanceMonitor.class);
   repository = proxyFactory.getProxy();
 }