Package samples.abstractmocking

Examples of samples.abstractmocking.AbstractMethodMocking


        assertNotNull(mock(AbstractMethodMocking.class));
    }

    @Test
    public void canSpyOnAnonymousClasses() throws Exception {
        AbstractMethodMocking tested = new AbstractMethodMocking() {
            @Override
            protected String getIt() {
                return null;
            }
        };

        assertNull(tested.getValue());
        AbstractMethodMocking spy = spy(tested);
        when(spy.getValue()).thenReturn("something");

        assertEquals("something", spy.getValue());
    }
View Full Code Here


public class AbstractMethodMockingTest {

  @Test
  public void testMockingOfAbstractMethod() throws Exception {
    final String value = "a string";
    AbstractMethodMocking tested = createPartialMock(
        AbstractMethodMocking.class, "getIt");

    expectPrivate(tested, "getIt").andReturn(value);

    replay(tested);

    assertEquals(value, tested.getValue());

    verify(tested);
  }
View Full Code Here

TOP

Related Classes of samples.abstractmocking.AbstractMethodMocking

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.