diff --git a/CHANGELOG.md b/CHANGELOG.md index 03427db2d..8aba9e4ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Added missing fields to Application, capabilities and webhooks - Removed `PageList` (replaced by `HalPageResponse`) - Improved documentation for Application API implementation +- Relaxed UUID validation in `VoiceClient` # [7.6.0] - 2023-06-30 - Added Proactive Connect API implementation diff --git a/src/main/java/com/vonage/client/voice/VoiceClient.java b/src/main/java/com/vonage/client/voice/VoiceClient.java index 76adaf3cf..17ef78007 100644 --- a/src/main/java/com/vonage/client/voice/VoiceClient.java +++ b/src/main/java/com/vonage/client/voice/VoiceClient.java @@ -23,7 +23,6 @@ import java.net.URI; import java.net.URISyntaxException; import java.util.Objects; -import java.util.UUID; /** * A client for talking to the Vonage Voice API. The standard way to obtain an instance of this class is to use {@link @@ -60,7 +59,7 @@ public VoiceClient(HttpWrapper httpWrapper) { } private String validateUuid(String uuid) { - return UUID.fromString(Objects.requireNonNull(uuid, "UUID is required.")).toString(); + return Objects.requireNonNull(uuid, "UUID is required."); } private String validateUrl(String url) { diff --git a/src/test/java/com/vonage/client/voice/VoiceClientTest.java b/src/test/java/com/vonage/client/voice/VoiceClientTest.java index 94c6f5511..98347618c 100644 --- a/src/test/java/com/vonage/client/voice/VoiceClientTest.java +++ b/src/test/java/com/vonage/client/voice/VoiceClientTest.java @@ -136,9 +136,7 @@ public void testSendDtmf() throws Exception { assertThrows(IllegalArgumentException.class, () -> client.sendDtmf("944dd293-ca13-4a58-bc37-6252e11474be", null) ); - assertThrows(IllegalArgumentException.class, () -> - client.sendDtmf("invalid", "1234") - ); + assertThrows(NullPointerException.class, () -> client.sendDtmf(null, "1234")); } @Test @@ -146,7 +144,7 @@ public void testModifyCall() throws Exception { VoiceClient client = new VoiceClient(stubHttpWrapper(200, "{\"message\":\"Received\"}")); ModifyCallResponse call = client.modifyCall("93137ee3-580e-45f7-a61a-e0b5716000ef", ModifyCallAction.HANGUP); assertEquals("Received", call.getMessage()); - assertThrows(IllegalArgumentException.class, () -> client.modifyCall("invalid", ModifyCallAction.HANGUP)); + assertThrows(NullPointerException.class, () -> client.modifyCall(null, ModifyCallAction.HANGUP)); assertThrows(NullPointerException.class, () -> client.modifyCall("93137ee3-580e-45f7-a61a-e0b5716000ef", null) ); @@ -352,7 +350,7 @@ public void testStopTalk() throws Exception { TalkResponse response = client.stopTalk("944dd293-ca13-4a58-bc37-6252e11474be"); assertEquals("Talk stopped", response.getMessage()); assertEquals("944dd293-ca13-4a58-bc37-6252e11474be", response.getUuid()); - assertThrows(IllegalArgumentException.class, () -> client.stopTalk("Blah")); + assertThrows(NullPointerException.class, () -> client.stopTalk(null)); } @Test