• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2007 Mockito contributors
3  * This program is made available under the terms of the MIT License.
4  */
5 package org.mockito;
6 
7 import java.lang.reflect.Constructor;
8 import java.util.List;
9 
10 /**
11  * Represents a mock of any object construction of the represented type. Within the scope of the
12  * mocked construction, the invocation of any interceptor will generate a mock which will be
13  * prepared as specified when generating this scope. The mock can also be received via this
14  * instance.
15  * <p>
16  * If the {@link Mock} annotation is used on fields or method parameters of this type, a mocked
17  * construction is created instead of a regular mock. The mocked construction is activated and
18  * released upon completing any relevant test.
19  *
20  * @param <T> The type for which the construction is being mocked.
21  */
22 public interface MockedConstruction<T> extends ScopedMock {
23 
constructed()24     List<T> constructed();
25 
26     interface Context {
27 
getCount()28         int getCount();
29 
constructor()30         Constructor<?> constructor();
31 
arguments()32         List<?> arguments();
33     }
34 
35     interface MockInitializer<T> {
36 
prepare(T mock, Context context)37         void prepare(T mock, Context context) throws Throwable;
38     }
39 }
40