Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
rmiccoli committed Oct 24, 2023
1 parent f1e833d commit 0c76dc5
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package it.infn.mw.iam.test.repository;

import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.hasSize;
Expand Down Expand Up @@ -189,11 +190,17 @@ public void testTokenNoCascadeDeletion() {
@Test
public void testTokenCascadeDeletion() {
OAuth2AccessTokenEntity at = buildAccessToken(loadTestClient(), TEST_347_USER);
accessTokenRepo.save(at);
OAuth2RefreshTokenEntity rt = at.getRefreshToken();
refreshTokenRepo.save(rt);
AuthenticationHolderEntity ah = at.getAuthenticationHolder();
authenticationHolderRepo.save(ah);
assertThat(accessTokenRepo.findAll()).hasSize(1);
assertThat(refreshTokenRepo.findAll()).hasSize(1);
assertThat(authenticationHolderRepo.getById(ah.getId()) != null, is(true));
authenticationHolderRepo.remove(ah);
assertThat(accessTokenRepo.findById(at.getId()).isEmpty(), is(true));
assertThat(refreshTokenRepo.findById(rt.getId()).isEmpty(), is(true));
assertThat(accessTokenRepo.findAll()).isEmpty();
assertThat(refreshTokenRepo.findAll()).isEmpty();
assertThat(authenticationHolderRepo.getById(ah.getId()) != null, is(false));
}

Expand Down

0 comments on commit 0c76dc5

Please sign in to comment.