Skip to content

Commit

Permalink
restore assertThat
Browse files Browse the repository at this point in the history
  • Loading branch information
adoroszlai committed Dec 22, 2023
1 parent 1a7c313 commit cae2219
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_KERBEROS_PRINCIPAL_KEY;
import static org.apache.hadoop.security.UserGroupInformation.AuthenticationMethod.KERBEROS;
import static org.apache.ozone.test.GenericTestUtils.waitFor;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
Expand Down Expand Up @@ -201,7 +202,7 @@ public void blockTokenFailsOnExpiredSecretKey() throws Exception {
StorageContainerException ex = assertThrows(StorageContainerException.class,
() -> readDataWithoutRetry(keyInfo));
assertEquals(BLOCK_TOKEN_VERIFICATION_FAILED, ex.getResult());
assertTrue(ex.getMessage().contains("Token can't be verified due to expired secret key"));
assertThat(ex).hasMessageContaining("Token can't be verified due to expired secret key");
}

@Test
Expand Down Expand Up @@ -247,7 +248,7 @@ public void blockTokenFailsOnWrongSecretKeyId() throws Exception {
assertThrows(StorageContainerException.class,
() -> readDataWithoutRetry(keyInfo));
assertEquals(BLOCK_TOKEN_VERIFICATION_FAILED, ex.getResult());
assertTrue(ex.getMessage().contains("Can't find the signing secret key"));
assertThat(ex).hasMessageContaining("Can't find the signing secret key");
}

@Test
Expand All @@ -270,7 +271,7 @@ public void blockTokenFailsOnWrongPassword() throws Exception {
assertThrows(StorageContainerException.class,
() -> readDataWithoutRetry(keyInfo));
assertEquals(BLOCK_TOKEN_VERIFICATION_FAILED, ex.getResult());
assertTrue(ex.getMessage().contains("Invalid token for user"));
assertThat(ex).hasMessageContaining("Invalid token for user");
}

private UUID extractSecretKeyId(OmKeyInfo keyInfo) throws IOException {
Expand Down

0 comments on commit cae2219

Please sign in to comment.