Package samples.classhierarchy

Examples of samples.classhierarchy.ChildA


@PrepareForTest({ChildA.class, ChildB.class, Parent.class})
public class CommonParentTest {

  @Test
  public void testPossibleToMockTwoClassesWithSameParent() throws Exception {
    ChildA a = PowerMock.createMock(ChildA.class);
    EasyMock.expect(a.getValue()).andReturn(5);
   
    PowerMock.replay(a);
   
    assertEquals(5, a.getValue());
   
    PowerMock.verify(a);
  }
View Full Code Here


@PrepareForTest( { StaticAndInstanceMethodWithSameNameUser.class, StaticAndInstanceMethodWithSameName.class })
public class MethodWithSameNameButDifferentDefinitionTypeTest {

    @Test
    public void mockGatewayCanInvokeInstanceMethodWhenClassContainsStaticAndInstanceMethodWithSameName() throws Exception {
        final ChildA object = createMock(ChildA.class);
        StaticAndInstanceMethodWithSameName mock = createMock(StaticAndInstanceMethodWithSameName.class);

        expectNew(ChildA.class).andReturn(object);
        mock.overloaded((Parent) object);
        expectLastCall().once();
View Full Code Here

* MockGateway.
*/
public class OverloadingDemo {

    public void performSingleOverloadedArgumentTest() {
        Parent object = new ChildA();
        OverloadedMethodsExample.overloadedMethodWithOneArgument(object);
    }
View Full Code Here

        Parent object = new ChildA();
        OverloadedMethodsExample.overloadedMethodWithOneArgument(object);
    }

    public void performMethodOverloadTestWhenBothArgumentSame() {
        Parent object1 = new ChildA();
        Parent object2 = new ChildA();
        OverloadedMethodsExample.overloadedMethodWithTwoArguments(object1, object2);
    }
View Full Code Here

        Parent object2 = new ChildA();
        OverloadedMethodsExample.overloadedMethodWithTwoArguments(object1, object2);
    }

    public void performMethodOverloadTestWithOneArgumentSameAndOneDiffernt() {
        Parent object1 = new ChildA();
        Parent object2 = new Parent();
        OverloadedMethodsExample.overloadedMethodWithTwoArguments(object2, object1);
    }
View Full Code Here

* differ because one is static and one is instance.
*/
public class StaticAndInstanceMethodWithSameNameUser {

    public void performInstaceInvocation(StaticAndInstanceMethodWithSameName object) {
        Parent child = new ChildA();
        object.overloaded(child);
    }
View Full Code Here

        Parent child = new ChildA();
        object.overloaded(child);
    }

    public void performStaticInvocation() {
        Parent child = new ChildA();
        StaticAndInstanceMethodWithSameName.overloaded((ChildA) child);
    }
View Full Code Here

TOP

Related Classes of samples.classhierarchy.ChildA

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.