/** * Search for available Nexmo Virtual Numbers. * * @throws IOException if an error occurs contacting the Nexmo API * @throws NexmoClientException if an error is returned by the server. */ public SearchNumbersResponse searchNumbers(String country) throws IOException, NexmoClientException { return this.searchNumbers(new SearchNumbersFilter(country)); }
@Test public void testSearchNumbers() throws Exception { NumbersClient client = new NumbersClient(stubHttpWrapper(200, "{\n" + " \"count\": 4,\n" + " \"numbers\": [\n" + " {\n" + " \"country\": \"GB\",\n" + " \"msisdn\": \"447700900000\",\n" + " \"cost\": \"0.50\",\n" + " \"type\": \"mobile\",\n" + " \"features\": [\n" + " \"VOICE\",\n" + " \"SMS\"\n" + " ]\n" + " }\n" + " ]\n" + "}")); SearchNumbersResponse response = client.searchNumbers("YY"); assertEquals(4, response.getCount()); }