Package org.mockito.exceptions

Examples of org.mockito.exceptions.Reporter


@SuppressWarnings("unchecked")
public class CreationValidator {

    public void validateType(Class classToMock) {
        if (!ClassImposterizer.INSTANCE.canImposterise(classToMock)) {
            new Reporter().cannotMockFinalClass(classToMock);
        }
    }
View Full Code Here


            return;
        }
       
        for (Class i : extraInterfaces) {
            if (classToMock == i) {
                new Reporter().extraInterfacesCannotContainMockedType(classToMock);
            }
        }
    }
View Full Code Here

        public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable {
            if (Invocation.isToString(method)) {
                return "SmartNull returned by unstubbed " + invocation.getMethod().getName() + "() method on mock";
            }
           
            new Reporter().smartNullPointerException(location);
            return null;
        }
View Full Code Here

        description.appendText("<Capturing argument>");
    }

    public T getLastValue() {
        if (arguments.isEmpty()) {
            new Reporter().noArgumentValueWasCaptured();
            return null;
        } else {
            return (T) arguments.getLast();
        }
    }
View Full Code Here

    private void validateMatchers(Invocation invocation, List<Matcher> matchers) {
        if (!matchers.isEmpty()) {
            int recordedMatchersSize = matchers.size();
            int expectedMatchersSize = invocation.getArgumentsCount();
            if (expectedMatchersSize != recordedMatchersSize) {
                new Reporter().invalidUseOfMatchers(expectedMatchersSize, recordedMatchersSize);
            }
        }
    }
View Full Code Here

        }
    }

    static void throwIfAlreadyAssigned(Field field, boolean alreadyAssigned) {
        if (alreadyAssigned) {
            new Reporter().moreThanOneAnnotationNotAllowed(field.getName());
        }
    }
View Full Code Here

        if (wanted == null) {
            return;
        }
        ObjectMethodsGuru o = new ObjectMethodsGuru();
        if (o.isToString(wanted.getMethod())) {
            new Reporter().cannotVerifyToString();
        }
    }
View Full Code Here

        }
    }
   
    void throwIfAlreadyAssigned(Field field, boolean alreadyAssigned) {
        if (alreadyAssigned) {
            new Reporter().moreThanOneAnnotationNotAllowed(field.getName());
        }
    }
View Full Code Here

        try {
            report = new FieldInitializer(fieldOwner, field).initialize();
        } catch (MockitoException e) {
            if(e.getCause() instanceof InvocationTargetException) {
                Throwable realCause = e.getCause().getCause();
                new Reporter().fieldInitialisationThrewException(field, realCause);
            }
            new Reporter().cannotInitializeForInjectMocksAnnotation(field.getName(), e);
        }


        // for each field in the class hierarchy
        boolean injectionOccurred = false;
View Full Code Here

    }

    void assertNoAnnotations(final Field field, final Class ... annotations) {
        for (Class annotation : annotations) {
            if (field.isAnnotationPresent(annotation)) {
                new Reporter().unsupportedCombinationOfAnnotations(annotation.getSimpleName(), InjectMocks.class.getSimpleName());
            }
        }       
    }
View Full Code Here

TOP

Related Classes of org.mockito.exceptions.Reporter

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.