Examples of simpleMethod()


Examples of org.mockitousage.IMethods.simpleMethod()

           
            when(mock.simpleMethod(1)).thenReturn("one");
            when(mock.simpleMethod(2)).thenReturn("two");
           
            assertEquals("one", mock.simpleMethod(1));
            assertEquals("two", mock.simpleMethod(2));
           
            verify(mock).simpleMethod(1);
            verify(mock).simpleMethod(2);
        }
    }
View Full Code Here

Examples of org.mockitousage.IMethods.simpleMethod()

       
        @Test
        @Ignore
        public void test() {
            IMethods mock = mock(IMethods.class);
            mock.simpleMethod(1);
            mock.otherMethod();
           
            verify(mock).simpleMethod(1);
            throw new RuntimeException("boo");
        }
View Full Code Here

Examples of org.mockitousage.IMethods.simpleMethod()

        public void _test() {
            IMethods mock = mock(IMethods.class);
           
            //some stubbing
            when(mock.simpleMethod(1)).thenReturn("foo");
            when(mock.otherMethod()).thenReturn("foo");
            when(mock.booleanObjectReturningMethod()).thenReturn(false);

            //stub called with different args:
            String ret = mock.simpleMethod(2);
View Full Code Here

Examples of org.mockitousage.IMethods.simpleMethod()

            when(mock.simpleMethod(1)).thenReturn("foo");
            when(mock.otherMethod()).thenReturn("foo");
            when(mock.booleanObjectReturningMethod()).thenReturn(false);

            //stub called with different args:
            String ret = mock.simpleMethod(2);

            //assertion fails due to stub called with different args
            assertEquals("foo", ret);
        }
    }   
View Full Code Here

Examples of org.mockitousage.IMethods.simpleMethod()

   
    @Test
    public void shouldNotShowTypesWhenTypesAreTheSameEvenIfToStringGivesTheSameResult() throws Exception {
        //given
        IMethods mock = mock(IMethods.class);
        mock.simpleMethod(new Foo(10));
       
        try {
            //when
            verify(mock).simpleMethod(new Foo(20));
            fail();
View Full Code Here

Examples of org.mockitousage.IMethods.simpleMethod()

    public void shouldSayUnstubbedMethodWasInvokedHere() {
        mock = mock(IMethods.class, RETURNS_SMART_NULLS);
       
        IMethods m = mock.iMethodsReturningMethod();
       
        m.simpleMethod();
    }
   
    @Test
    public void shouldPointOutUnfinishedStubbing() {
        when(mock.simpleMethod());
View Full Code Here

Examples of org.mockitousage.IMethods.simpleMethod()

        // when
      imethodsMock.simpleMethod(1);
        ByteArrayOutputStream serialized = serializeMock(imethodsMock);
        IMethods readObject = deserializeMock(serialized, IMethods.class);
        readObject.simpleMethod(1);

        // then
        verify(readObject, times(2)).simpleMethod(1);

        //this test is working because it seems that java serialization mechanism replaces all instances
View Full Code Here

Examples of org.mockitousage.IMethods.simpleMethod()

        //given
        // when
        when(imethodsMock.simpleMethod(1)).thenReturn("foo");
        ByteArrayOutputStream serialized = serializeMock(imethodsMock);
        IMethods readObject = deserializeMock(serialized, IMethods.class);
        when(readObject.simpleMethod(2)).thenReturn("bar");

        // then
        assertEquals("foo", readObject.simpleMethod(1));
        assertEquals("bar", readObject.simpleMethod(2));
    }
View Full Code Here

Examples of org.mockitousage.IMethods.simpleMethod()

        ByteArrayOutputStream serialized = serializeMock(imethodsMock);
        IMethods readObject = deserializeMock(serialized, IMethods.class);
        when(readObject.simpleMethod(2)).thenReturn("bar");

        // then
        assertEquals("foo", readObject.simpleMethod(1));
        assertEquals("bar", readObject.simpleMethod(2));
    }

    @Test
    public void should_verify_call_order_for_serialized_mock() throws Exception {
View Full Code Here

Examples of org.mockitousage.IMethods.simpleMethod()

        IMethods readObject = deserializeMock(serialized, IMethods.class);
        when(readObject.simpleMethod(2)).thenReturn("bar");

        // then
        assertEquals("foo", readObject.simpleMethod(1));
        assertEquals("bar", readObject.simpleMethod(2));
    }

    @Test
    public void should_verify_call_order_for_serialized_mock() throws Exception {
        imethodsMock.arrayReturningMethod();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.