112112import org .mockito .Captor ;
113113import org .mockito .InOrder ;
114114import org .mockito .Mock ;
115- import org .mockito .junit .MockitoJUnit ;
116- import org .mockito .junit .MockitoRule ;
115+ import org .mockito .MockitoAnnotations ;
117116
118117/** Unit tests for {@link ServerImpl}. */
119118@ RunWith (JUnit4 .class )
@@ -140,7 +139,6 @@ public boolean shouldAccept(Runnable runnable) {
140139 };
141140 private static final String AUTHORITY = "some_authority" ;
142141
143- @ Rule public final MockitoRule mocks = MockitoJUnit .rule ();
144142 @ Rule public final ExpectedException thrown = ExpectedException .none ();
145143
146144 @ BeforeClass
@@ -164,9 +162,11 @@ public Context filterContext(Context context) {
164162 return newCtx .withValue (SERVER_TRACER_ADDED_KEY , "context added by tracer" );
165163 }
166164 };
167- @ Mock private ObjectPool < Executor > executorPool ;
168- @ Mock private ClientTransportServersBuilder mockClientTransportServersBuilder ;
165+ @ Mock
166+ private ObjectPool < Executor > executorPool ;
169167 private ServerImplBuilder builder ;
168+ @ Mock
169+ private ClientTransportServersBuilder mockClientTransportServersBuilder ;
170170 private MutableHandlerRegistry mutableFallbackRegistry = new MutableHandlerRegistry ();
171171 private HandlerRegistry fallbackRegistry = mock (
172172 HandlerRegistry .class ,
@@ -202,6 +202,7 @@ public List<ServerServiceDefinition> getServices() {
202202 /** Set up for test. */
203203 @ Before
204204 public void startUp () throws IOException {
205+ MockitoAnnotations .initMocks (this );
205206 builder = new ServerImplBuilder (mockClientTransportServersBuilder );
206207 builder .channelz = channelz ;
207208 builder .ticker = timer .getDeadlineTicker ();
0 commit comments