@@ -39,46 +39,49 @@ public final class Mocks {
3939 // 4) Mock invocations are cleared -> throws NullPointerException
4040 Lib199Subsystem .registerPeriodic (() -> MOCKS .removeIf (CLEAR_INVOCATIONS_ON_REFERENCED_MOCK_IF_REFERNCE_NOT_CLEARED ));
4141 }
42-
42+
4343 /**
4444 * Attempts to create an instance of a class in which some or all of the classes methods are replaced with a mocked implementation
45- * @param T the class type which will be mocked
46- * @param U the class type which will be used to provide method implementations
45+ * @param <T> the class type which will be mocked
46+ * @param <U> the class type which will be used to provide method implementations
4747 * @param classToMock the class type which will be mocked
4848 * @param implClass the object to which to try to forward method calls
4949 * @param interfaces a list of interfaces which the mocked object should extend
5050 * @return an instance of <code>T</code> in which some or all of the classes methods are replaced with a mocked implementation from <code>U</code>
51- * @see #createMock(java.lang.Class, java.lang.Object, java.lang.Class...)
51+ * @see #createMock(Class, Object, boolean, Class...)
52+ * @see #createMock(Class, Object, Answer, Class...)
5253 */
5354 public static <T , U > T createMock (Class <T > classToMock , U implClass , Class <?>... interfaces ) {
5455 return createMock (classToMock , implClass , true , interfaces );
5556 }
56-
57+
5758 /**
5859 * Attempts to create an instance of a class in which some or all of the classes methods are replaced with a mocked implementation
59- * @param T the class type which will be mocked
60- * @param U the class type which will be used to provide method implementations
60+ * @param <T> the class type which will be mocked
61+ * @param <U> the class type which will be used to provide method implementations
6162 * @param classToMock the class type which will be mocked
6263 * @param implClass the object to which to try to forward method calls
6364 * @param forwardUnknownCalls whether methods which are not overriden will call their real methods
6465 * @param interfaces a list of interfaces which the mocked object should extend
6566 * @return an instance of <code>T</code> in which some or all of the classes methods are replaced with a mocked implementation from <code>U</code>
66- * @see #createMock(java.lang.Class, java.lang.Object)
67+ * @see #createMock(Class, Object, Class...)
68+ * @see #createMock(Class, Object, Answer, Class...)
6769 */
6870 public static <T , U > T createMock (Class <T > classToMock , U implClass , boolean forwardUnknownCalls , Class <?>... interfaces ) {
6971 return createMock (classToMock , implClass , forwardUnknownCalls ? InvocationOnMock ::callRealMethod : new ReturnsSmartNulls (), interfaces );
7072 }
71-
73+
7274 /**
7375 * Attempts to create an instance of a class in which some or all of the classes methods are replaced with a mocked implementation
74- * @param T the class type which will be mocked
75- * @param U the class type which will be used to provide method implementations
76+ * @param <T> the class type which will be mocked
77+ * @param <U> the class type which will be used to provide method implementations
7678 * @param classToMock the class type which will be mocked
7779 * @param implClass the object to which to try to forward method calls
7880 * @param defaultAnswer The answer to use when no overriden implementation is found
7981 * @param interfaces a list of interfaces which the mocked object should extend
8082 * @return an instance of <code>T</code> in which some or all of the classes methods are replaced with a mocked implementation from <code>U</code>
81- * @see #createMock(java.lang.Class, java.lang.Object)
83+ * @see #createMock(Class, Object, Class...)
84+ * @see #createMock(Class, Object, boolean, Class...)
8285 */
8386 public static <T , U > T createMock (Class <T > classToMock , U implClass , Answer <Object > defaultAnswer , Class <?>... interfaces ) {
8487 HashMap <Method , InvokableMethod > methods = new HashMap <>();
@@ -104,7 +107,13 @@ public static <T, U> T createMock(Class<T> classToMock, U implClass, Answer<Obje
104107 T mock = mock (classToMock , settings );
105108 return mock ;
106109 }
107-
110+
111+ /**
112+ * Lists all of the methods available in the provided base class and interface classes
113+ * @param base The base class to search
114+ * @param interfaces Additional interface classes to search
115+ * @return An array of all the detected methods
116+ */
108117 public static Method [] listMethods (Class <?> base , Class <?>... interfaces ) {
109118 ArrayList <Method > out = new ArrayList <>();
110119 out .addAll (Arrays .asList (base .getMethods ()));
@@ -114,7 +123,7 @@ public static Method[] listMethods(Class<?> base, Class<?>... interfaces) {
114123
115124 /**
116125 * A wrapper for the underlying Mockito method which automatically calls {@link Mockito#clearInvocations(Object...)} to prevent memory leaks
117- *
126+ *
118127 * @see Mockito#mock(Class)
119128 */
120129 public static <T > T mock (Class <T > classToMock ) {
@@ -187,6 +196,6 @@ public Object answer(InvocationOnMock invocation) throws Throwable {
187196
188197 private static interface InvokableMethod {
189198 public Object invoke (Object object , Object [] args ) throws IllegalAccessException , IllegalArgumentException , InvocationTargetException ;
190- }
199+ }
191200
192201}
0 commit comments