diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d68aa824..78dbe731e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,10 +2,11 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). -# [8.14.0] - 2024-11-?? +# [8.14.0] - 2024-11-14 - Close HTTP responses to prevent resource leaks - Added `RedactResponseException` and deprecated `VonageBadRequestException` - Added `maxBitrate` to `com.vonage.client.video.Archive` +- Added varargs `removeCapabilities` method to `Application.Builder` # [8.13.0] - 2024-10-28 - Added support for Verify custom templates diff --git a/src/main/java/com/vonage/client/application/Application.java b/src/main/java/com/vonage/client/application/Application.java index 0d5f079d0..af21bf36a 100644 --- a/src/main/java/com/vonage/client/application/Application.java +++ b/src/main/java/com/vonage/client/application/Application.java @@ -191,6 +191,21 @@ public Builder addCapability(Capability capability) { return this; } + /** + * Removes the specified capabilities from the application. + * + * @param types The type of capabilities to remove as an array / varargs. + * + * @return This builder. + * @since 8.14.0 + */ + public Builder removeCapabilities(Capability.Type... types) { + for (Capability.Type type : types) { + removeCapability(type); + } + return this; + } + /** * Remove a capability from the application. * diff --git a/src/test/java/com/vonage/client/application/ApplicationTest.java b/src/test/java/com/vonage/client/application/ApplicationTest.java index a7842e2ef..618b303e0 100644 --- a/src/test/java/com/vonage/client/application/ApplicationTest.java +++ b/src/test/java/com/vonage/client/application/ApplicationTest.java @@ -114,8 +114,7 @@ public void testRemoveMultipleCapabilities() { Application application = Application.builder() .addCapability(Voice.builder().build()) .addCapability(Rtc.builder().build()) - .removeCapability(Capability.Type.VOICE) - .removeCapability(Capability.Type.RTC) + .removeCapabilities(Capability.Type.VOICE, Capability.Type.RTC) .build(); assertEquals(json, application.toJson()); diff --git a/src/test/java/com/vonage/client/redact/RedactClientTest.java b/src/test/java/com/vonage/client/redact/RedactClientTest.java index 1549f89a5..52b2f85a3 100644 --- a/src/test/java/com/vonage/client/redact/RedactClientTest.java +++ b/src/test/java/com/vonage/client/redact/RedactClientTest.java @@ -18,6 +18,7 @@ import com.vonage.client.AbstractClientTest; import com.vonage.client.DynamicEndpointTestSpec; import com.vonage.client.RestEndpoint; +import com.vonage.client.TestUtils; import com.vonage.client.auth.ApiKeyHeaderAuthMethod; import com.vonage.client.auth.AuthMethod; import com.vonage.client.common.HttpMethod; @@ -25,6 +26,7 @@ import org.junit.jupiter.api.*; import java.util.Collection; import java.util.List; +import java.util.UUID; public class RedactClientTest extends AbstractClientTest { @@ -43,7 +45,14 @@ public void testSuccessfulResponse() throws Exception { } @Test - public void testInvalidRedactRequests() { + public void testRedactResponseException() throws Exception { + assert401ApiResponseException(RedactResponseException.class, () -> + client.redactTransaction(UUID.randomUUID().toString(), RedactRequest.Product.MESSAGES) + ); + } + + @Test + public void testInvalidRedactRequests() throws Exception { assertThrows(IllegalArgumentException.class, () -> client.redactTransaction( "test-id", RedactRequest.Product.SMS ));