|
27 | 27 | import org.junit.jupiter.params.provider.EnumSource; |
28 | 28 | import org.mockito.Mock; |
29 | 29 | import org.mockito.MockedStatic; |
30 | | -import org.mockito.Mockito; |
31 | 30 | import org.mockito.MockitoAnnotations; |
32 | 31 | import org.springframework.test.util.ReflectionTestUtils; |
33 | 32 | import org.web3j.crypto.Credentials; |
|
37 | 36 | import org.web3j.protocol.core.RemoteFunctionCall; |
38 | 37 | import org.web3j.protocol.core.methods.response.Log; |
39 | 38 | import org.web3j.protocol.core.methods.response.TransactionReceipt; |
40 | | -import org.web3j.tx.TransactionManager; |
41 | 39 | import org.web3j.utils.Numeric; |
42 | 40 |
|
43 | | -import java.math.BigInteger; |
44 | 41 | import java.time.Duration; |
45 | 42 | import java.util.List; |
46 | 43 | import java.util.Optional; |
@@ -79,21 +76,13 @@ class IexecHubServiceTests { |
79 | 76 | @BeforeEach |
80 | 77 | void init() throws Exception { |
81 | 78 | MockitoAnnotations.openMocks(this); |
82 | | - when(blockchainAdapterConfigurationService.getIexecHubContractAddress()).thenReturn("hub"); |
| 79 | + when(blockchainAdapterConfigurationService.getIexecHubContractAddress()).thenReturn("0x748e091bf16048cb5103E0E10F9D5a8b7fBDd860"); |
83 | 80 | when(blockchainAdapterConfigurationService.getBlockTime()).thenReturn(Duration.ofSeconds(5L)); |
84 | 81 | when(blockchainAdapterConfigurationService.getChainId()).thenReturn(65535); |
85 | 82 | credentials = Credentials.create(Keys.createEcKeyPair()); |
86 | 83 | when(credentialsService.getCredentials()).thenReturn(credentials); |
87 | 84 | when(web3jService.getWeb3j()).thenReturn(web3jClient); |
88 | | - try (MockedStatic<IexecHubContract> iexecHubContract = Mockito.mockStatic(IexecHubContract.class)) { |
89 | | - final IexecHubContract mockIexecContract = mock(IexecHubContract.class); |
90 | | - final RemoteFunctionCall<BigInteger> mockRemoteFunctionCall = mock(RemoteFunctionCall.class); |
91 | | - iexecHubContract.when(() -> IexecHubContract.load(any(), any(), (TransactionManager) any(), any())) |
92 | | - .thenReturn(mockIexecContract); |
93 | | - when(mockIexecContract.contribution_deadline_ratio()).thenReturn(mockRemoteFunctionCall); |
94 | | - when(mockRemoteFunctionCall.send()).thenReturn(BigInteger.ONE); |
95 | | - iexecHubService = spy(new IexecHubService(credentialsService, web3jService, blockchainAdapterConfigurationService)); |
96 | | - } |
| 85 | + iexecHubService = spy(new IexecHubService(credentialsService, web3jService, blockchainAdapterConfigurationService)); |
97 | 86 | ReflectionTestUtils.setField(iexecHubService, "iexecHubContract", iexecHubContract); |
98 | 87 | } |
99 | 88 |
|
@@ -205,7 +194,7 @@ void shouldNotContributeRevealWhenInterrupted() throws ExecutionException, Inter |
205 | 194 | assertThat(Thread.currentThread().isInterrupted()).isTrue(); |
206 | 195 | } |
207 | 196 | } |
208 | | - // end region |
| 197 | + // endregion |
209 | 198 |
|
210 | 199 | // region contributeAndFinalize |
211 | 200 | @Test |
|
0 commit comments