@ObjectFactory public IObjectFactory newInstance() { return new MyObjectFactory(); } }
@ObjectFactory public IObjectFactory create(ITestContext context) { assert context != null; return new ObjectFactoryImpl(); } }
@ObjectFactory public Object create() { return new LoggingObjectFactory(); } }
@ObjectFactory public IObjectFactory create() { return new LoggingObjectFactory(); } }
@ObjectFactory public IObjectFactory create() { return new CombinedTestAndObjectFactorySample(); }
/** * @param context the test context. * @return The PowerMock object factory. */ @ObjectFactory public IObjectFactory create(ITestContext context) { try { final Class<?> powerMockObjectFactory = Class.forName("org.powermock.modules.testng.PowerMockObjectFactory"); return (IObjectFactory) powerMockObjectFactory.newInstance(); } catch (ClassNotFoundException e) { throw new IllegalStateException("Missing org.powermock.modules.testng.PowerMockObjectFactory in classpath."); } catch (Exception e) { throw new RuntimeException("PowerMock internal error", e); } }
@ObjectFactory public IObjectFactory getObjectFactory(ITestContext context) throws Exception { Class<?> clazz = Class.forName("org.activejpa.enhancer.ActiveJpaAgentLoaderImpl"); Method method = clazz.getMethod("loadAgent"); method.invoke(null); return new ObjectFactoryImpl(); }
/** * We need a special {@link IObjectFactory}. * * @return {@link PowerMockObjectFactory}. */ @ObjectFactory public IObjectFactory getObjectFactory() { return new PowerMockObjectFactory(); }
@ObjectFactory public IObjectFactory getObjectFactory() { return new org.powermock.modules.testng.PowerMockObjectFactory(); }
/** * Note: Kind of hack to ensure that ActiveJPAAgent instruments all the models before they are loaded. * * @param context * @return * @throws Exception */ @ObjectFactory public IObjectFactory getObjectFactory(ITestContext context) throws Exception { ActiveJpaAgentLoader.instance().loadAgent(); return new ObjectFactoryImpl(); }