Package org.powermock.tests.utils.impl

Examples of org.powermock.tests.utils.impl.MockPolicyInitializerImpl


    for (PowerMockJUnit3RunnerDelegate delegate : delegates) {
      TestChunk next = iterator.next();
      final PowerMockJUnit3TestListener listener = new PowerMockJUnit3TestListener(next.getClassLoader());
      result.addListener(listener);
      // Initialize mock policies for each test
      new MockPolicyInitializerImpl(delegate.getTestClass()).initialize(this.getClass().getClassLoader());
      delegate.run(result);
      result.removeListener(listener);
    }
  }
View Full Code Here


                mockLoader.addIgnorePackage(expectedExceptionsExtractor.getPackagesToIgnore(testClass));
    mockLoader.addClassesToModify(testClassesExtractor.getTestClasses(testClass));
                mockLoader.addClassesToModify(staticConstructorSuppressExtractor.getClassesToModify(testClass));
    try {
      registerProxyframework(mockLoader);
      new MockPolicyInitializerImpl(testClass).initialize(mockLoader);
      final Class<?> testClassLoadedByMockedClassLoader = createTestClass(testClass);
      Constructor<?> con = testClassLoadedByMockedClassLoader.getConstructor(constructor.getParameterTypes());
      final Object testInstance = con.newInstance(params);
      if (!extendsPowerMockTestCase(testClass)) {
        setInvocationHandler(testInstance);
View Full Code Here

            // Initialize mock policies for each test
            final ClassLoader classloader = this.getClass().getClassLoader();
            final Thread currentThread = Thread.currentThread();
            final ClassLoader originalClassLoader = currentThread.getContextClassLoader();
            currentThread.setContextClassLoader(classloader);
            new MockPolicyInitializerImpl(testClass.getJavaClass()).initialize(classloader);
            powerMockTestNotifier.notifyBeforeTestMethod(testInstance, method, new Object[0]);
            try {
                super.runBeforesThenTestThenAfters(test);
            } finally {
                currentThread.setContextClassLoader(originalClassLoader);
View Full Code Here

                            && !className.startsWith("java.lang")
                            && !className.startsWith("org.powermock")
                            && !className.startsWith("org.junit")
                            && !new PrepareForTestExtractorImpl().isPrepared(testClassAsJavaClass, className)
                            && !testClassAsJavaClass.isAnnotationPresent(PrepareEverythingForTest.class)
                            && !new MockPolicyInitializerImpl(testClassAsJavaClass.isAnnotationPresent(MockPolicy.class) ? testClassAsJavaClass
                            .getAnnotation(MockPolicy.class).value() : null).isPrepared(className)) {
                        Whitebox.setInternalState(actualFailure, "detailMessage", "Perhaps the class " + className + " must be prepared for test?",
                                Throwable.class);
                    }
                    addFailure(actualFailure);
View Full Code Here

        final String[] packagesToIgnore = powerMockIgnorePackagesExtractor.getPackagesToIgnore(testClass);
        redefine(classesToPrepare, packagesToIgnore);
        redefine(classesToSuppress, packagesToIgnore);
        final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
        registerProxyframework(contextClassLoader);
        new MockPolicyInitializerImpl(testClass).initialize(contextClassLoader);
    }
View Full Code Here

   
        mockLoader.addIgnorePackage(ignorePackagesExtractor.getPackagesToIgnore(testClass));
        mockLoader.addClassesToModify(testClassesExtractor.getTestClasses(testClass));
        mockLoader.addClassesToModify(staticInitializationExtractor.getTestClasses(testClass));
        registerProxyframework(mockLoader);
        new MockPolicyInitializerImpl(testClass).initialize(mockLoader);
        return new ClassloaderExecutor(mockLoader);
    }
View Full Code Here

TOP

Related Classes of org.powermock.tests.utils.impl.MockPolicyInitializerImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.