2727import com .iexec .resultproxy .chain .IexecHubService ;
2828import org .junit .jupiter .api .BeforeEach ;
2929import org .junit .jupiter .api .Test ;
30+ import org .junit .jupiter .api .extension .ExtendWith ;
3031import org .mockito .Mock ;
31- import org .mockito .MockitoAnnotations ;
32+ import org .mockito .junit . jupiter . MockitoExtension ;
3233import org .springframework .beans .factory .annotation .Autowired ;
3334import org .springframework .boot .test .autoconfigure .data .mongo .DataMongoTest ;
3435import org .springframework .test .context .DynamicPropertyRegistry ;
5960
6061@ DataMongoTest
6162@ Testcontainers
63+ @ ExtendWith (MockitoExtension .class )
6264class AuthorizationServiceTests {
6365
6466 private static final String RESULT_DIGEST = "0x3210" ;
@@ -84,7 +86,6 @@ static void registerProperties(DynamicPropertyRegistry registry) {
8486
8587 @ BeforeEach
8688 void beforeEach () throws GeneralSecurityException {
87- MockitoAnnotations .openMocks (this );
8889 enclaveCreds = Credentials .create (Keys .createEcKeyPair ());
8990 workerCreds = Credentials .create (Keys .createEcKeyPair ());
9091 authorizationRepository .deleteAll ();
@@ -135,7 +136,6 @@ void shouldNotBeAuthorizedOnExecutionOfTeeTaskWhenTaskTypeNotMatchedOnchainWithD
135136 @ Test
136137 void shouldNotBeAuthorizedOnExecutionOfTeeTaskWhenGetTaskFailedWithDetails () {
137138 final WorkerpoolAuthorization auth = getWorkerpoolAuthorization (true );
138- when (iexecHubService .isTeeTask (auth .getChainTaskId ())).thenReturn (true );
139139 when (iexecHubService .getChainTask (auth .getChainTaskId ())).thenReturn (Optional .empty ());
140140
141141 Optional <AuthorizationError > isAuth = authorizationService .isAuthorizedOnExecutionWithDetailedIssue (auth );
@@ -149,7 +149,6 @@ void shouldNotBeAuthorizedOnExecutionOfTeeTaskWhenFinalDeadlineReached() {
149149 .dealid (CHAIN_DEAL_ID )
150150 .finalDeadline (Instant .now ().minus (5L , ChronoUnit .SECONDS ).toEpochMilli ())
151151 .build ();
152- when (iexecHubService .isTeeTask (auth .getChainTaskId ())).thenReturn (true );
153152 when (iexecHubService .getChainTask (auth .getChainTaskId ())).thenReturn (Optional .of (chainTask ));
154153
155154 Optional <AuthorizationError > isAuth = authorizationService .isAuthorizedOnExecutionWithDetailedIssue (auth );
@@ -162,7 +161,6 @@ void shouldNotBeAuthorizedOnExecutionOfTeeTaskWhenGetDealFailedWithDetails() {
162161 final WorkerpoolAuthorization auth = getWorkerpoolAuthorization (true );
163162 auth .setSignature (new Signature (POOL_WRONG_SIGNATURE ));
164163
165- when (iexecHubService .isTeeTask (auth .getChainTaskId ())).thenReturn (true );
166164 when (iexecHubService .getChainTask (auth .getChainTaskId ())).thenReturn (Optional .of (chainTask ));
167165 when (iexecHubService .getChainDeal (chainTask .getDealid ())).thenReturn (Optional .empty ());
168166
0 commit comments