Package samples.privatefield

Examples of samples.privatefield.MockSelfPrivateFieldServiceClass


@PrepareForTest(MockSelfPrivateFieldServiceClass.class)
public class MockSelfPrivateFieldServiceClassTest {

  @Test
  public void testGetCompositeMessage() throws Exception {
    MockSelfPrivateFieldServiceClass tested = createPartialMock(MockSelfPrivateFieldServiceClass.class, "getOwnMessage");

    Service serviceMock = createMock(Service.class);
    setInternalState(tested, "service", serviceMock, MockSelfPrivateFieldServiceClass.class);

    final String expected = "Hello world";
    expectPrivate(tested, "getOwnMessage").andReturn("Hello");
    expect(serviceMock.getServiceMessage()).andReturn(" world");

    replay(serviceMock);
    replay(tested);

    final String actual = tested.getCompositeMessage();

    verify(serviceMock);
    verify(tested);

    assertEquals(expected, actual);
View Full Code Here

TOP

Related Classes of samples.privatefield.MockSelfPrivateFieldServiceClass

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.