Skip to content

Commit

Permalink
More permissive UUID for Voice
Browse files Browse the repository at this point in the history
  • Loading branch information
SMadani committed Aug 10, 2023
1 parent d9d801c commit d5469fb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/vonage/client/voice/VoiceClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down
8 changes: 3 additions & 5 deletions src/test/java/com/vonage/client/voice/VoiceClientTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,15 @@ 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
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)
);
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d5469fb

Please sign in to comment.