Package org.mockito.internal.util

Examples of org.mockito.internal.util.MockName


        this(oldMockHandler.mockName, oldMockHandler.mockingProgress, oldMockHandler.matchersBinder, oldMockHandler.mockSettings);
    }
   
    //for tests
    MockHandler() {
        this(new MockName("mockie for tests", MockHandler.class), new ThreadSafeMockingProgress(), new MatchersBinder(), new MockSettingsImpl());
    }
View Full Code Here


     * @see org.mockito.stubbing.Answer#answer(org.mockito.invocation.InvocationOnMock)
     */
    public Object answer(InvocationOnMock invocation) {
        if (Invocation.isToString(invocation)) {
            Object mock = invocation.getMock();
            MockName name = new MockUtil().getMockName(mock);
            if (name.isSurrogate()) {
                return "Mock for " + ClassNameFinder.classNameForMock(mock) + ", hashCode: " + mock.hashCode();
            } else {
                return name.toString();
            }
        }
       
        Class<?> returnType = invocation.getMethod().getReturnType();
        return returnValueFor(returnType);
View Full Code Here

    public boolean isSerializable() {
        return serializable;
    }
   
    public void initiateMockName(Class classToMock) {
        mockName = new MockName(name, classToMock);
    }
View Full Code Here

     * @see org.mockito.stubbing.Answer#answer(org.mockito.invocation.InvocationOnMock)
     */
    public Object answer(InvocationOnMock invocation) {
        if (methodsGuru.isToString(invocation.getMethod())) {
            Object mock = invocation.getMock();
            MockName name = new MockUtil().getMockName(mock);
            if (name.isSurrogate()) {
                return "Mock for " + ClassNameFinder.classNameForMock(mock) + ", hashCode: " + mock.hashCode();
            } else {
                return name.toString();
            }
        } else if (methodsGuru.isCompareToMethod(invocation.getMethod())) {
            //see issue 184.
            //mocks by default should not return 0 for compareTo because they are not the same. Hence we return 1 (anything but 0 is good).
            //Only for compareTo() method by the Comparable interface
View Full Code Here

    public boolean isSerializable() {
        return serializable;
    }
   
    public void initiateMockName(Class classToMock) {
        mockName = new MockName(name, classToMock);
    }
View Full Code Here

     * @see org.mockito.configuration.ReturnValues#valueFor(org.mockito.invocation.InvocationOnMock)
     */
    public Object valueFor(InvocationOnMock invocation) {
        if (Invocation.isToString(invocation)) {
            Object mock = invocation.getMock();
            MockName name = MockUtil.getMockName(mock);
            if (name.isSurrogate()) {
                return "Mock for " + ClassNameFinder.classNameForMock(mock) + ", hashCode: " + mock.hashCode();
            } else {
                return name.toString();
            }
        }
       
        Class<?> returnType = invocation.getMethod().getReturnType();
        return returnValueFor(returnType);
View Full Code Here

     * @see org.mockito.stubbing.Answer#answer(org.mockito.invocation.InvocationOnMock)
     */
    public Object answer(InvocationOnMock invocation) {
        if (Invocation.isToString(invocation)) {
            Object mock = invocation.getMock();
            MockName name = new MockUtil().getMockName(mock);
            if (name.isSurrogate()) {
                return "Mock for " + ClassNameFinder.classNameForMock(mock) + ", hashCode: " + mock.hashCode();
            } else {
                return name.toString();
            }
        }
       
        Class<?> returnType = invocation.getMethod().getReturnType();
        return returnValueFor(returnType);
View Full Code Here

                        oldMockHandler.mockSettings);
    }

    // for tests
    MockHandler() {
        this(new MockName("mockie for tests", MockHandler.class), new ThreadSafeMockingProgress(),
                        new MatchersBinder(), new MockSettingsImpl());
    }
View Full Code Here

    public boolean isSerializable() {
        return serializable;
    }
   
    public void initiateMockName(Class classToMock) {
        mockName = new MockName(name, classToMock);
    }
View Full Code Here

TOP

Related Classes of org.mockito.internal.util.MockName

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.