-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'spy-mock' into release/3.x
# Conflicts: # version.properties
- Loading branch information
Showing
30 changed files
with
1,600 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright (c) 2007 Mockito contributors | ||
* This program is made available under the terms of the MIT License. | ||
*/ | ||
package org.mockito; | ||
|
||
import java.lang.reflect.Constructor; | ||
import java.util.List; | ||
|
||
/** | ||
* Represents a mock of any object construction of the represented type. Within the scope of the | ||
* mocked construction, the invocation of any interceptor will generate a mock which will be | ||
* prepared as specified when generating this scope. The mock can also be received via this | ||
* instance. | ||
* <p> | ||
* If the {@link Mock} annotation is used on fields or method parameters of this type, a mocked | ||
* construction is created instead of a regular mock. The mocked construction is activated and | ||
* released upon completing any relevant test. | ||
* | ||
* @param <T> The type for which the construction is being mocked. | ||
*/ | ||
@Incubating | ||
public interface MockedConstruction<T> extends ScopedMock { | ||
|
||
List<T> constructed(); | ||
|
||
interface Context { | ||
|
||
int getCount(); | ||
|
||
Constructor<?> constructor(); | ||
|
||
List<?> arguments(); | ||
} | ||
|
||
interface MockInitializer<T> { | ||
|
||
void prepare(T mock, Context context) throws Throwable; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright (c) 2007 Mockito contributors | ||
* This program is made available under the terms of the MIT License. | ||
*/ | ||
package org.mockito; | ||
|
||
/** | ||
* Represents a mock with a thread-local explicit scope. Scoped mocks must be closed by the entity | ||
* that activates the scoped mock. | ||
*/ | ||
@Incubating | ||
public interface ScopedMock extends AutoCloseable { | ||
|
||
/** | ||
* Checks if this mock is closed. | ||
* | ||
* @return {@code true} if this mock is closed. | ||
*/ | ||
boolean isClosed(); | ||
|
||
/** | ||
* Closes this scoped mock and throws an exception if already closed. | ||
*/ | ||
@Override | ||
void close(); | ||
|
||
/** | ||
* Releases this scoped mock and is non-operational if already released. | ||
*/ | ||
void closeOnDemand(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.