All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fitbur.mockito.internal.util.reflection.Constructors Maven / Gradle / Ivy

There is a newer version: 1.0.0
Show newest version
package com.fitbur.mockito.internal.util.reflection;

import java.lang.reflect.Constructor;

public abstract class Constructors {

    /**
     * Returns the no arg constructor of the type if any.
     *
     * @param classToMock The type to look for a no-arg constructor
     * @return The no-arg constructor or null if none is declared.
     */
    public static Constructor noArgConstructorOf(Class classToMock) {
        try {
            return classToMock.getDeclaredConstructor();
        } catch (NoSuchMethodException e) {
            return null;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy