use of com.amazonaws.services.secretsmanager.model.PutSecretValueResult in project fernet-java8 by l0s.
the class MemoryOverwritingRequestHandlerTest method verifyAfterErrorClearsSecret.
@Test
public void verifyAfterErrorClearsSecret() {
// given
final ByteBuffer secretBinary = ByteBuffer.wrap(new byte[] { 1, 1, 2, 3, 5, 8 });
assertTrue(Arrays.equals(secretBinary.array(), new byte[] { 1, 1, 2, 3, 5, 8 }));
final PutSecretValueRequest originalRequest = new PutSecretValueRequest();
originalRequest.setSecretBinary(secretBinary);
final Request<PutSecretValueRequest> request = new DefaultRequest<PutSecretValueRequest>(originalRequest, "AWSSecretsManager");
final PutSecretValueResult result = mock(PutSecretValueResult.class);
final HttpResponse httpResponse = mock(HttpResponse.class);
final Response<PutSecretValueResult> response = new Response<PutSecretValueResult>(result, httpResponse);
// when
handler.afterError(request, response, new Exception());
// then
assertFalse(Arrays.equals(secretBinary.array(), new byte[] { 1, 1, 2, 3, 5, 8 }));
}
use of com.amazonaws.services.secretsmanager.model.PutSecretValueResult in project fernet-java8 by l0s.
the class MemoryOverwritingRequestHandlerTest method verifyAfterResponseClearsSecret.
@Test
public void verifyAfterResponseClearsSecret() {
// given
final ByteBuffer secretBinary = ByteBuffer.wrap(new byte[] { 1, 1, 2, 3, 5, 8 });
assertTrue(Arrays.equals(secretBinary.array(), new byte[] { 1, 1, 2, 3, 5, 8 }));
final PutSecretValueRequest originalRequest = new PutSecretValueRequest();
originalRequest.setSecretBinary(secretBinary);
final Request<PutSecretValueRequest> request = new DefaultRequest<PutSecretValueRequest>(originalRequest, "AWSSecretsManager");
final PutSecretValueResult result = mock(PutSecretValueResult.class);
final HttpResponse httpResponse = mock(HttpResponse.class);
final Response<PutSecretValueResult> response = new Response<PutSecretValueResult>(result, httpResponse);
// when
handler.afterResponse(request, response);
// then
assertFalse(Arrays.equals(secretBinary.array(), new byte[] { 1, 1, 2, 3, 5, 8 }));
}
Aggregations