Package samples.staticandinstance

Examples of samples.staticandinstance.StaticAndInstanceWithConstructorCodeDemo


  @Test
  public void testStaticAndInstanceWithConstructor() throws Exception {
    StaticAndInstanceDemo staticAndInstanceDemoMock = createMock(StaticAndInstanceDemo.class);

    StaticAndInstanceWithConstructorCodeDemo tested = new StaticAndInstanceWithConstructorCodeDemo(
        staticAndInstanceDemoMock);

    niceReplayAndVerify();

    mockStaticPartial(StaticAndInstanceDemo.class, "getStaticMessage");

    final String instanceExpected = "value";
    expect(staticAndInstanceDemoMock.getMessage()).andReturn(
        instanceExpected);

    final String staticExpected = "a static message";
    expect(StaticAndInstanceDemo.getStaticMessage()).andReturn(
        staticExpected);

    replay(StaticAndInstanceDemo.class, staticAndInstanceDemoMock, tested);

    String actual = tested.getMessage();

    verify(StaticAndInstanceDemo.class, staticAndInstanceDemoMock, tested);

    assertEquals(staticExpected + instanceExpected, actual);
  }
View Full Code Here

TOP

Related Classes of samples.staticandinstance.StaticAndInstanceWithConstructorCodeDemo

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.