Refine search
@Before public void before() throws Exception { MockitoAnnotations.initMocks(this); loader = spy(new FilterLoader(registry, compiler, filterFactory)); doReturn(TestZuulFilter.class).when(compiler).compile(file); when(file.getAbsolutePath()).thenReturn("/filters/in/SomeFilter.groovy"); }
@Before public void setUp() { MockitoAnnotations.initMocks(this); when(arrayPool.get(anyInt(), eq(byte[].class))) .thenAnswer(new Answer<byte[]>() { @Override public byte[] answer(InvocationOnMock invocation) throws Throwable { int size = (Integer) invocation.getArguments()[0]; return new byte[size]; } }); }
@Before public void setUp() throws IOException { MockitoAnnotations.initMocks(this); String assetPath = "/some/asset/path"; fetcher = new StreamAssetPathFetcher(assetManager, assetPath); when(assetManager.open(eq(assetPath))).thenReturn(expected); }
@Before public void setUp() throws Exception { initMocks(this); Mockito.when(mURL.openConnection()).thenReturn(mConnection); Mockito.when(mURL.openConnection(mProxy)).thenReturn(mConnection); }
@Before public void setUp() throws PackageManager.NameNotFoundException { MockitoAnnotations.initMocks(this); applicationInfo = new ApplicationInfo(); applicationInfo.metaData = new Bundle(); String packageName = "com.bumptech.test"; when(context.getPackageName()).thenReturn(packageName); PackageManager pm = mock(PackageManager.class); when(pm.getApplicationInfo(eq(packageName), eq(PackageManager.GET_META_DATA))) .thenReturn(applicationInfo); when(context.getPackageManager()).thenReturn(pm); parser = new ManifestParser(context); }
@Before public void setUp() { MockitoAnnotations.initMocks(this); doAnswer(new AddBitmapPoolAnswer(addedBitmaps)).when(pool).put(any(Bitmap.class)); when(pool.getDirty(anyInt(), anyInt(), any(Bitmap.Config.class))) .thenAnswer(new CreateBitmap()); when(cache.put(any(Key.class), anyResource())) .thenAnswer(new AddBitmapCacheAnswer(addedBitmaps)); }
@Before public void setUp() throws IOException { MockitoAnnotations.initMocks(this); URL url = new URL("http://www.google.com"); when(connectionFactory.build(eq(url))).thenReturn(urlConnection); when(urlConnection.getInputStream()).thenReturn(stream); when(urlConnection.getResponseCode()).thenReturn(200); when(glideUrl.toURL()).thenReturn(url); fetcher = new HttpUrlFetcher(glideUrl, TIMEOUT_MS, connectionFactory); }
@Before public void setup() { MockitoAnnotations.initMocks(this); when(bitmapPool.get(anyInt(), anyInt(), any(Bitmap.Config.class))) .thenAnswer(new Util.CreateBitmap()); Context context = RuntimeEnvironment.application; Glide.init(context, new GlideBuilder().setBitmapPool(bitmapPool)); circleCrop = new CircleCrop(); }
@Before public void setup() { MockitoAnnotations.initMocks(this); this.exchangeFunction = mock(ExchangeFunction.class); when(this.exchangeFunction.exchange(this.captor.capture())).thenReturn(Mono.empty()); this.builder = WebClient.builder().baseUrl("/base").exchangeFunction(this.exchangeFunction); }
@Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); WebSocketClient webSocketClient = mock(WebSocketClient.class); this.stompClient = new TestWebSocketStompClient(webSocketClient); this.stompClient.setTaskScheduler(this.taskScheduler); this.stompClient.setStompSession(this.stompSession); this.webSocketHandlerCaptor = ArgumentCaptor.forClass(WebSocketHandler.class); this.handshakeFuture = new SettableListenableFuture<>(); when(webSocketClient.doHandshake(this.webSocketHandlerCaptor.capture(), any(), any(URI.class))) .thenReturn(this.handshakeFuture); }
@Before public void setUp() { MockitoAnnotations.initMocks(this); when(arrayPool.get(bufferSize, byte[].class)).thenReturn(new byte[bufferSize]); os = new BufferedOutputStream(inner, arrayPool, bufferSize); }