Fix test_buck by not using lambdas inside ReactImagePropertyTest (#35181)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/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
This commit is contained in:
Nicola Corti 2022-11-02 16:02:53 -07:00 коммит произвёл Facebook GitHub Bot
Родитель 5d26ceaa23
Коммит 46de03a46a
1 изменённых файлов: 15 добавлений и 2 удалений

Просмотреть файл

@ -35,6 +35,7 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
@ -61,9 +62,21 @@ public class ReactImagePropertyTest {
public void setup() {
PowerMockito.mockStatic(Arguments.class);
PowerMockito.when(Arguments.createArray())
.thenAnswer((InvocationOnMock invocation) -> new JavaOnlyArray());
.thenAnswer(
new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocation) {
return new JavaOnlyArray();
}
});
PowerMockito.when(Arguments.createMap())
.thenAnswer((InvocationOnMock invocation) -> new JavaOnlyMap());
.thenAnswer(
new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocation) {
return new JavaOnlyMap();
}
});
// RNLog is stubbed out and the whole class need to be mocked
PowerMockito.mockStatic(RNLog.class);