1package org.mockito.internal.util.reflection;
2
3import java.lang.reflect.Constructor;
4
5public abstract class Constructors {
6
7    /**
8     * Returns the no arg constructor of the type if any.
9     *
10     * @param classToMock The type to look for a no-arg constructor
11     * @return The no-arg constructor or null if none is declared.
12     */
13    public static Constructor<?> noArgConstructorOf(Class<?> classToMock) {
14        try {
15            return classToMock.getDeclaredConstructor();
16        } catch (NoSuchMethodException e) {
17            return null;
18        }
19    }
20}
21