Skip to content

Commit

Permalink
[NetworkingModuleTest] Mock classes for testSuccessfulPostRequest
Browse files Browse the repository at this point in the history
Fixes UnsatisfiedLinkError while running unit test
  • Loading branch information
allengleyzer committed Oct 26, 2017
1 parent 9560789 commit bc015a8
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,14 @@ public WritableMap answer(InvocationOnMock invocation) throws Throwable {

@Test
public void testSuccessfulPostRequest() throws Exception {
PowerMockito.mockStatic(RequestBodyUtil.class);
when(RequestBodyUtil.getFileInputStream(any(ReactContext.class), any(String.class)))
.thenReturn(mock(InputStream.class));
when(RequestBodyUtil.create(any(MediaType.class), any(InputStream.class)))
.thenReturn(mock(RequestBody.class));
when(RequestBodyUtil.createProgressRequest(any(RequestBody.class), any(ProgressListener.class)))
.thenCallRealMethod();

OkHttpClient httpClient = mock(OkHttpClient.class);
when(httpClient.newCall(any(Request.class))).thenAnswer(new Answer<Object>() {
@Override
Expand Down

0 comments on commit bc015a8

Please sign in to comment.