@Test
public void testValidateFailsIfCredentialsAreDisabled(final TestContext ctx) {
final AbstractDeviceCredentials creds = getDeviceCredentials("type", "tenant", "identity");
final CredentialsObject credentialsOnRecord = getCredentialsObject("type", "identity", "device", false)
.addSecret(CredentialsObject.emptySecret(Instant.now().minusSeconds(120), null));
when(credentialsClient.get(eq("type"), eq("identity"), any(JsonObject.class), any()))
.thenReturn(Future.succeededFuture(credentialsOnRecord));
provider.authenticate(creds, null, ctx.asyncAssertFailure(t -> {
ctx.assertEquals(HttpURLConnection.HTTP_UNAUTHORIZED, ((ClientErrorException) t).getErrorCode());
}));
}