test: use assertInstanceOf() where applicable
This commit is contained in:
parent
2f5b25d847
commit
c35760d0ab
@ -136,7 +136,7 @@ class HTTPVaultConnectorBuilderTest {
|
|||||||
() -> HTTPVaultConnector.builder().fromEnv(),
|
() -> HTTPVaultConnector.builder().fromEnv(),
|
||||||
"Creation with unknown cert path failed"
|
"Creation with unknown cert path failed"
|
||||||
);
|
);
|
||||||
assertTrue(e.getCause() instanceof NoSuchFileException);
|
assertInstanceOf(NoSuchFileException.class, e.getCause());
|
||||||
assertEquals(VAULT_CACERT, ((NoSuchFileException) e.getCause()).getFile());
|
assertEquals(VAULT_CACERT, ((NoSuchFileException) e.getCause()).getFile());
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -909,7 +909,7 @@ class HTTPVaultConnectorIT {
|
|||||||
assertFalse(res.getAuth().isRenewable(), "Root token should not be renewable");
|
assertFalse(res.getAuth().isRenewable(), "Root token should not be renewable");
|
||||||
assertFalse(res.getAuth().isOrphan(), "Root token should not be orphan");
|
assertFalse(res.getAuth().isOrphan(), "Root token should not be orphan");
|
||||||
|
|
||||||
// Starting with Vault 1.0 a warning "custom ID uses weaker SHA1.." is given.
|
// Starting with Vault 1.0 a warning "custom ID uses weaker SHA1..." is given.
|
||||||
// Starting with Vault 1.11 a second warning "Endpoint ignored unrecognized parameters" is given.
|
// Starting with Vault 1.11 a second warning "Endpoint ignored unrecognized parameters" is given.
|
||||||
assertFalse(res.getWarnings().isEmpty(), "Token creation did not return expected warning");
|
assertFalse(res.getWarnings().isEmpty(), "Token creation did not return expected warning");
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ class HTTPVaultConnectorTest {
|
|||||||
"Querying health status succeeded on invalid instance"
|
"Querying health status succeeded on invalid instance"
|
||||||
);
|
);
|
||||||
assertEquals("Unable to connect to Vault server", e.getMessage(), "Unexpected exception message");
|
assertEquals("Unable to connect to Vault server", e.getMessage(), "Unexpected exception message");
|
||||||
assertTrue(e.getCause() instanceof IOException, "Unexpected cause");
|
assertInstanceOf(IOException.class, e.getCause(), "Unexpected cause");
|
||||||
|
|
||||||
// Now simulate a failing request that succeeds on second try.
|
// Now simulate a failing request that succeeds on second try.
|
||||||
connector = HTTPVaultConnector.builder(wireMock.url("/")).withNumberOfRetries(1).withTimeout(250).build();
|
connector = HTTPVaultConnector.builder(wireMock.url("/")).withNumberOfRetries(1).withTimeout(250).build();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user