Skip to content

Commit 46de03a

Browse files
cortinicofacebook-github-bot
authored andcommitted
Fix test_buck by not using lambdas inside ReactImagePropertyTest (facebook#35181)
Summary: Pull Request resolved: facebook#35181 As the title says, this unblocks `test_buck` by removign the lambdas used inside test. Changelog: [Internal] [Changed] - Fix test_buck by not using lambdas inside ReactImagePropertyTest Reviewed By: cipolleschi Differential Revision: D40958412 fbshipit-source-id: 60b8609a25985230dfd6c4dcdf983dc2a8cfaf64
1 parent 5d26cea commit 46de03a

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

ReactAndroid/src/test/java/com/facebook/react/views/image/ReactImagePropertyTest.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import org.junit.Test;
3636
import org.junit.runner.RunWith;
3737
import org.mockito.invocation.InvocationOnMock;
38+
import org.mockito.stubbing.Answer;
3839
import org.powermock.api.mockito.PowerMockito;
3940
import org.powermock.core.classloader.annotations.PowerMockIgnore;
4041
import org.powermock.core.classloader.annotations.PrepareForTest;
@@ -61,9 +62,21 @@ public class ReactImagePropertyTest {
6162
public void setup() {
6263
PowerMockito.mockStatic(Arguments.class);
6364
PowerMockito.when(Arguments.createArray())
64-
.thenAnswer((InvocationOnMock invocation) -> new JavaOnlyArray());
65+
.thenAnswer(
66+
new Answer<Object>() {
67+
@Override
68+
public Object answer(InvocationOnMock invocation) {
69+
return new JavaOnlyArray();
70+
}
71+
});
6572
PowerMockito.when(Arguments.createMap())
66-
.thenAnswer((InvocationOnMock invocation) -> new JavaOnlyMap());
73+
.thenAnswer(
74+
new Answer<Object>() {
75+
@Override
76+
public Object answer(InvocationOnMock invocation) {
77+
return new JavaOnlyMap();
78+
}
79+
});
6780

6881
// RNLog is stubbed out and the whole class need to be mocked
6982
PowerMockito.mockStatic(RNLog.class);

0 commit comments

Comments
 (0)