Skip to content

Commit

Permalink
Remove all Incubating annotations (#2437)
Browse files Browse the repository at this point in the history
For all of these APIs, we have been shipping them for at least 1 major
release. We consider all of these APIs part of the public API contract
now and therefore we should mark them as such.

This PR removes all usages of the annotation. If we were to later remove
an API, it will first have to be deprecated and then removed in a
subsequent major release. However, we have no plans to do so with any of
these APIs.
  • Loading branch information
TimvdLippe committed Oct 4, 2021
1 parent c8dbc10 commit 7032574
Show file tree
Hide file tree
Showing 48 changed files with 0 additions and 177 deletions.
13 changes: 0 additions & 13 deletions src/main/java/org/mockito/AdditionalAnswers.java
Expand Up @@ -330,7 +330,6 @@ public static <T> Answer<T> returnsElementsOf(Collection<?> elements) {
*
* @since 2.8.44
*/
@Incubating
public static <T> Answer<T> answersWithDelay(long sleepyTime, Answer<T> answer) {
return (Answer<T>) new AnswersWithDelay(sleepyTime, (Answer<Object>) answer);
}
Expand All @@ -344,7 +343,6 @@ public static <T> Answer<T> answersWithDelay(long sleepyTime, Answer<T> answer)
* @return the answer object to use
* @since 2.1.0
*/
@Incubating
public static <T, A> Answer<T> answer(Answer1<T, A> answer) {
return toAnswer(answer);
}
Expand All @@ -357,7 +355,6 @@ public static <T, A> Answer<T> answer(Answer1<T, A> answer) {
* @return the answer object to use
* @since 2.1.0
*/
@Incubating
public static <A> Answer<Void> answerVoid(VoidAnswer1<A> answer) {
return toAnswer(answer);
}
Expand All @@ -372,7 +369,6 @@ public static <A> Answer<Void> answerVoid(VoidAnswer1<A> answer) {
* @return the answer object to use
* @since 2.1.0
*/
@Incubating
public static <T, A, B> Answer<T> answer(Answer2<T, A, B> answer) {
return toAnswer(answer);
}
Expand All @@ -386,7 +382,6 @@ public static <T, A, B> Answer<T> answer(Answer2<T, A, B> answer) {
* @return the answer object to use
* @since 2.1.0
*/
@Incubating
public static <A, B> Answer<Void> answerVoid(VoidAnswer2<A, B> answer) {
return toAnswer(answer);
}
Expand All @@ -402,7 +397,6 @@ public static <A, B> Answer<Void> answerVoid(VoidAnswer2<A, B> answer) {
* @return the answer object to use
* @since 2.1.0
*/
@Incubating
public static <T, A, B, C> Answer<T> answer(Answer3<T, A, B, C> answer) {
return toAnswer(answer);
}
Expand All @@ -417,7 +411,6 @@ public static <T, A, B, C> Answer<T> answer(Answer3<T, A, B, C> answer) {
* @return the answer object to use
* @since 2.1.0
*/
@Incubating
public static <A, B, C> Answer<Void> answerVoid(VoidAnswer3<A, B, C> answer) {
return toAnswer(answer);
}
Expand All @@ -434,7 +427,6 @@ public static <A, B, C> Answer<Void> answerVoid(VoidAnswer3<A, B, C> answer) {
* @return the answer object to use
* @since 2.1.0
*/
@Incubating
public static <T, A, B, C, D> Answer<T> answer(Answer4<T, A, B, C, D> answer) {
return toAnswer(answer);
}
Expand All @@ -450,7 +442,6 @@ public static <T, A, B, C, D> Answer<T> answer(Answer4<T, A, B, C, D> answer) {
* @return the answer object to use
* @since 2.1.0
*/
@Incubating
public static <A, B, C, D> Answer<Void> answerVoid(VoidAnswer4<A, B, C, D> answer) {
return toAnswer(answer);
}
Expand All @@ -468,7 +459,6 @@ public static <A, B, C, D> Answer<Void> answerVoid(VoidAnswer4<A, B, C, D> answe
* @return the answer object to use
* @since 2.1.0
*/
@Incubating
public static <T, A, B, C, D, E> Answer<T> answer(Answer5<T, A, B, C, D, E> answer) {
return toAnswer(answer);
}
Expand All @@ -486,7 +476,6 @@ public static <T, A, B, C, D, E> Answer<T> answer(Answer5<T, A, B, C, D, E> answ
* @return the answer object to use
* @since 2.1.0
*/
@Incubating
public static <A, B, C, D, E> Answer<Void> answerVoid(VoidAnswer5<A, B, C, D, E> answer) {
return toAnswer(answer);
}
Expand All @@ -506,7 +495,6 @@ public static <A, B, C, D, E> Answer<Void> answerVoid(VoidAnswer5<A, B, C, D, E>
* @return the answer object to use
* @since 2.26.0
*/
@Incubating
public static <T, A, B, C, D, E, F> Answer<T> answer(Answer6<T, A, B, C, D, E, F> answer) {
return toAnswer(answer);
}
Expand All @@ -525,7 +513,6 @@ public static <T, A, B, C, D, E, F> Answer<T> answer(Answer6<T, A, B, C, D, E, F
* @return the answer object to use
* @since 2.26.0
*/
@Incubating
public static <A, B, C, D, E, F> Answer<Void> answerVoid(VoidAnswer6<A, B, C, D, E, F> answer) {
return toAnswer(answer);
}
Expand Down
7 changes: 0 additions & 7 deletions src/main/java/org/mockito/MockSettings.java
Expand Up @@ -255,7 +255,6 @@ public interface MockSettings extends Serializable {
* @return settings instance so that you can fluently specify other settings
* @since 2.11.0
*/
@Incubating
MockSettings verificationStartedListeners(VerificationStartedListener... listeners);

/**
Expand Down Expand Up @@ -296,7 +295,6 @@ public interface MockSettings extends Serializable {
* @return settings instance so that you can fluently specify other settings
* @since 2.7.14 (useConstructor with no arguments was supported since 1.10.12)
*/
@Incubating
MockSettings useConstructor(Object... args);

/**
Expand All @@ -311,7 +309,6 @@ public interface MockSettings extends Serializable {
* @return settings instance so that you can fluently specify other settings
* @since 1.10.12
*/
@Incubating
MockSettings outerInstance(Object outerClassInstance);

/**
Expand All @@ -322,7 +319,6 @@ public interface MockSettings extends Serializable {
* @return settings instance so that you can fluently specify other settings
* @since 1.10.13
*/
@Incubating
MockSettings withoutAnnotations();

/**
Expand All @@ -337,7 +333,6 @@ public interface MockSettings extends Serializable {
* @return immutable view of mock settings
* @since 2.10.0
*/
@Incubating
<T> MockCreationSettings<T> build(Class<T> typeToMock);

/**
Expand All @@ -352,7 +347,6 @@ public interface MockSettings extends Serializable {
* @return immutable view of mock settings
* @since 2.10.0
*/
@Incubating
<T> MockCreationSettings<T> buildStatic(Class<T> classToMock);

/**
Expand All @@ -366,6 +360,5 @@ public interface MockSettings extends Serializable {
*
* For more information and an elaborate example, see {@link Mockito#lenient()}.
*/
@Incubating
MockSettings lenient();
}
1 change: 0 additions & 1 deletion src/main/java/org/mockito/MockedConstruction.java
Expand Up @@ -19,7 +19,6 @@
*
* @param <T> The type for which the construction is being mocked.
*/
@Incubating
public interface MockedConstruction<T> extends ScopedMock {

List<T> constructed();
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/mockito/MockedStatic.java
Expand Up @@ -23,7 +23,6 @@
*
* @param <T> The type being mocked.
*/
@Incubating
public interface MockedStatic<T> extends ScopedMock {

/**
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/mockito/MockingDetails.java
Expand Up @@ -117,7 +117,6 @@ public interface MockingDetails {
* @return mock handler instance of this mock
* @since 2.10.0
*/
@Incubating
MockHandler getMockHandler();

/**
Expand Down
15 changes: 0 additions & 15 deletions src/main/java/org/mockito/Mockito.java
Expand Up @@ -2068,7 +2068,6 @@ public static <T> T spy(T object) {
* @return a spy of the provided class
* @since 1.10.12
*/
@Incubating
public static <T> T spy(Class<T> classToSpy) {
return MOCKITO_CORE.mock(
classToSpy, withSettings().useConstructor().defaultAnswer(CALLS_REAL_METHODS));
Expand All @@ -2090,7 +2089,6 @@ public static <T> T spy(Class<T> classToSpy) {
* @param classToMock class or interface of which static mocks should be mocked.
* @return mock controller
*/
@Incubating
public static <T> MockedStatic<T> mockStatic(Class<T> classToMock) {
return mockStatic(classToMock, withSettings());
}
Expand All @@ -2112,7 +2110,6 @@ public static <T> MockedStatic<T> mockStatic(Class<T> classToMock) {
* @param defaultAnswer the default answer when invoking static methods.
* @return mock controller
*/
@Incubating
public static <T> MockedStatic<T> mockStatic(Class<T> classToMock, Answer defaultAnswer) {
return mockStatic(classToMock, withSettings().defaultAnswer(defaultAnswer));
}
Expand All @@ -2134,7 +2131,6 @@ public static <T> MockedStatic<T> mockStatic(Class<T> classToMock, Answer defaul
* @param name the name of the mock to use in error messages.
* @return mock controller
*/
@Incubating
public static <T> MockedStatic<T> mockStatic(Class<T> classToMock, String name) {
return mockStatic(classToMock, withSettings().name(name));
}
Expand All @@ -2156,7 +2152,6 @@ public static <T> MockedStatic<T> mockStatic(Class<T> classToMock, String name)
* @param mockSettings the settings to use where only name and default answer are considered.
* @return mock controller
*/
@Incubating
public static <T> MockedStatic<T> mockStatic(Class<T> classToMock, MockSettings mockSettings) {
return MOCKITO_CORE.mockStatic(classToMock, mockSettings);
}
Expand All @@ -2174,7 +2169,6 @@ public static <T> MockedStatic<T> mockStatic(Class<T> classToMock, MockSettings
* last answer is used. If this array is empty, the {@code defaultAnswer} is used.
* @return mock controller
*/
@Incubating
public static <T> MockedConstruction<T> mockConstructionWithAnswer(
Class<T> classToMock, Answer defaultAnswer, Answer... additionalAnswers) {
return mockConstruction(
Expand Down Expand Up @@ -2203,7 +2197,6 @@ public static <T> MockedConstruction<T> mockConstructionWithAnswer(
* @param classToMock non-abstract class of which constructions should be mocked.
* @return mock controller
*/
@Incubating
public static <T> MockedConstruction<T> mockConstruction(Class<T> classToMock) {
return mockConstruction(classToMock, index -> withSettings(), (mock, context) -> {});
}
Expand All @@ -2219,7 +2212,6 @@ public static <T> MockedConstruction<T> mockConstruction(Class<T> classToMock) {
* @param mockInitializer a callback to prepare a mock's methods after its instantiation.
* @return mock controller
*/
@Incubating
public static <T> MockedConstruction<T> mockConstruction(
Class<T> classToMock, MockedConstruction.MockInitializer<T> mockInitializer) {
return mockConstruction(classToMock, withSettings(), mockInitializer);
Expand All @@ -2236,7 +2228,6 @@ public static <T> MockedConstruction<T> mockConstruction(
* @param mockSettings the mock settings to use.
* @return mock controller
*/
@Incubating
public static <T> MockedConstruction<T> mockConstruction(
Class<T> classToMock, MockSettings mockSettings) {
return mockConstruction(classToMock, context -> mockSettings);
Expand All @@ -2253,7 +2244,6 @@ public static <T> MockedConstruction<T> mockConstruction(
* @param mockSettingsFactory the mock settings to use.
* @return mock controller
*/
@Incubating
public static <T> MockedConstruction<T> mockConstruction(
Class<T> classToMock,
Function<MockedConstruction.Context, MockSettings> mockSettingsFactory) {
Expand All @@ -2272,7 +2262,6 @@ public static <T> MockedConstruction<T> mockConstruction(
* @param mockInitializer a callback to prepare a mock's methods after its instantiation.
* @return mock controller
*/
@Incubating
public static <T> MockedConstruction<T> mockConstruction(
Class<T> classToMock,
MockSettings mockSettings,
Expand All @@ -2292,7 +2281,6 @@ public static <T> MockedConstruction<T> mockConstruction(
* @param mockInitializer a callback to prepare a mock's methods after its instantiation.
* @return mock controller
*/
@Incubating
public static <T> MockedConstruction<T> mockConstruction(
Class<T> classToMock,
Function<MockedConstruction.Context, MockSettings> mockSettingsFactory,
Expand Down Expand Up @@ -3257,7 +3245,6 @@ public static VerificationMode description(String description) {
*
* @since 2.1.0
*/
@Incubating
public static MockitoFramework framework() {
return new DefaultMockitoFramework();
}
Expand All @@ -3270,7 +3257,6 @@ public static MockitoFramework framework() {
*
* @since 2.7.0
*/
@Incubating
public static MockitoSessionBuilder mockitoSession() {
return new DefaultMockitoSessionBuilder();
}
Expand Down Expand Up @@ -3338,7 +3324,6 @@ public static MockitoSessionBuilder mockitoSession() {
*
* @since 2.20.0
*/
@Incubating
public static LenientStubber lenient() {
return MOCKITO_CORE.lenient();
}
Expand Down
7 changes: 0 additions & 7 deletions src/main/java/org/mockito/MockitoFramework.java
Expand Up @@ -19,7 +19,6 @@
*
* @since 2.1.0
*/
@Incubating
@NotExtensible
public interface MockitoFramework {

Expand Down Expand Up @@ -53,7 +52,6 @@ public interface MockitoFramework {
* @return this instance of mockito framework (fluent builder pattern)
* @since 2.1.0
*/
@Incubating
MockitoFramework addListener(MockitoListener listener) throws RedundantListenerException;

/**
Expand All @@ -70,7 +68,6 @@ public interface MockitoFramework {
* @return this instance of mockito framework (fluent builder pattern)
* @since 2.1.0
*/
@Incubating
MockitoFramework removeListener(MockitoListener listener);

/**
Expand All @@ -81,7 +78,6 @@ public interface MockitoFramework {
* @return object that gives access to mockito plugins
* @since 2.10.0
*/
@Incubating
MockitoPlugins getPlugins();

/**
Expand All @@ -91,7 +87,6 @@ public interface MockitoFramework {
* @return object that can construct invocations
* @since 2.10.0
*/
@Incubating
InvocationFactory getInvocationFactory();

/**
Expand Down Expand Up @@ -130,7 +125,6 @@ public interface MockitoFramework {
* @since 2.25.0
* @see #clearInlineMock(Object)
*/
@Incubating
void clearInlineMocks();

/**
Expand All @@ -142,6 +136,5 @@ public interface MockitoFramework {
* @since 2.25.0
* @see #clearInlineMocks()
*/
@Incubating
void clearInlineMock(Object mock);
}
4 changes: 0 additions & 4 deletions src/main/java/org/mockito/MockitoSession.java
Expand Up @@ -86,7 +86,6 @@
*
* @since 2.7.0
*/
@Incubating
@NotExtensible
public interface MockitoSession {

Expand All @@ -101,7 +100,6 @@ public interface MockitoSession {
* @param strictness new strictness for this session.
* @since 2.15.0
*/
@Incubating
void setStrictness(Strictness strictness);

/**
Expand All @@ -123,7 +121,6 @@ public interface MockitoSession {
* @see #finishMocking(Throwable)
* @since 2.7.0
*/
@Incubating
void finishMocking();

/**
Expand All @@ -140,6 +137,5 @@ public interface MockitoSession {
* @see #finishMocking()
* @since 2.15.0
*/
@Incubating
void finishMocking(Throwable failure);
}
1 change: 0 additions & 1 deletion src/main/java/org/mockito/ScopedMock.java
Expand Up @@ -8,7 +8,6 @@
* 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 {

/**
Expand Down

0 comments on commit 7032574

Please sign in to comment.