Package org.powermock.classloading

Examples of org.powermock.classloading.ClassloaderExecutor


    assertSame(tested.getMyArgument1(), tested.getMyArgument2());
    assertEquals(tested.getMyArgument1(), tested.getMyArgument3());
    assertSame(tested.getMyArgument3(), MyHierarchicalOverloadedFieldHolder.MY_ARGUMENT);
    assertNotSame(MyReferenceFieldHolder.MY_ARGUMENT, MyHierarchicalOverloadedFieldHolder.MY_ARGUMENT);
    assertEquals(MyReferenceFieldHolder.MY_ARGUMENT, MyHierarchicalOverloadedFieldHolder.MY_ARGUMENT);
    new ClassloaderExecutor(classloader).execute(new Runnable() {
      public void run() {
        assertEquals(MockClassLoader.class.getName(), this.getClass().getClassLoader().getClass().getName());
        assertSame(tested.getMyArgument1(), tested.getMyArgument2());
        assertEquals(tested.getMyArgument1(), tested.getMyArgument3());
        assertSame(tested.getMyArgument3(), MyHierarchicalOverloadedFieldHolder.MY_ARGUMENT);
View Full Code Here


    final MockClassLoader classloader = createClassloader();
    final MyArgument myArgument = new MyArgument("test");
    final MyReturnValue instance = new MyReturnValue(myArgument);
    Method method = instance.getClass().getMethod("getMyArgument");
    final ReflectionMethodInvoker tested = new ReflectionMethodInvoker(method, instance);
    new ClassloaderExecutor(classloader).execute(new Runnable() {
      public void run() {
        Object invoke = tested.invoke();
        assertSame(invoke, myArgument);
      }
    });
View Full Code Here

  public void loadsObjectGraphInSpecifiedClassloaderAndReturnsResultInOriginalClassloader() throws Exception {
    MockClassLoader classloader = createClassloader();
    final MyReturnValue expectedConstructorValue = new MyReturnValue(new MyArgument("first value"));
    final MyClass myClass = new MyClass(expectedConstructorValue);
    final MyArgument expected = new MyArgument("A value");
    MyReturnValue[] actual = new ClassloaderExecutor(classloader).execute(new Callable<MyReturnValue[]>() {
      public MyReturnValue[] call() throws Exception {
        assertEquals(MockClassLoader.class.getName(), this.getClass().getClassLoader().getClass().getName());
        return myClass.myMethod(expected);
      }
    });
View Full Code Here

  public void loadsObjectGraphThatIncludesPrimitiveValuesInSpecifiedClassloaderAndReturnsResultInOriginalClassloader()
      throws Exception {
    MockClassLoader classloader = createClassloader();
    final Integer expected = 42;
    final MyIntegerHolder myClass = new MyIntegerHolder(expected);
    Integer actual = new ClassloaderExecutor(classloader).execute(new Callable<Integer>() {
      public Integer call() throws Exception {
        assertEquals(MockClassLoader.class.getName(), this.getClass().getClassLoader().getClass().getName());
        final int myInteger = myClass.getMyInteger();
        assertEquals((int) expected, myInteger);
        return myInteger;
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.classloading.ClassloaderExecutor

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.