/** * Link a given Nexmo Virtual Number to a Nexmo Application with the given ID. * * @param msisdn The Nexmo Virtual Number to be updated. * @param country The country for the given msisdn. * @param appId The ID for the Nexmo Application to be associated with the number. * @throws IOException if an error occurs contacting the Nexmo API * @throws NexmoClientException if an error is returned by the server. */ public void linkNumber(String msisdn, String country, String appId) throws IOException, NexmoClientException { UpdateNumberRequest request = new UpdateNumberRequest(msisdn, country); request.setVoiceCallbackType(UpdateNumberRequest.CallbackType.APP); request.setVoiceCallbackValue(appId); this.updateNumber(request); } }
@Test public void testUpdateNumber() throws Exception { try { NumbersClient client = new NumbersClient(stubHttpWrapper(200, "{\n" + " \"error-code\":\"200\",\n" + " \"error-code-label\":\"success\"\n" + "}")); client.updateNumber(new UpdateNumberRequest( "447700900328", "UK" )); } catch (Exception e) { fail("Parsing a valid response should not raise an exception"); } }