Beispiel #1
0
  @Test
  public void testUpdateResponse() {
    new NonStrictExpectations() {
      {
        twilioRestClient.request((Request) any);
        result =
            new Response(
                "{\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"date_created\": \"2015-08-03T17:31:38Z\",\"date_updated\": \"2015-08-03T17:31:38Z\",\"default_activity_name\": \"Offline\",\"default_activity_sid\": \"WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"event_callback_url\": \"\",\"events_filter\": \"\",\"friendly_name\": \"8064de33-3a05-11e5-8bae-98e0d9a1eb73\",\"links\": {\"activities\": \"https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Activities\",\"statistics\": \"https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Statistics\",\"task_queues\": \"https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskQueues\",\"tasks\": \"https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Tasks\",\"workers\": \"https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers\",\"workflows\": \"https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workflows\"},\"multi_task_enabled\": \"false\",\"sid\": \"WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"timeout_activity_name\": \"Offline\",\"timeout_activity_sid\": \"WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"url\": \"https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}",
                TwilioRestClient.HTTP_STATUS_CODE_OK);
        twilioRestClient.getObjectMapper();
        result = new ObjectMapper();
      }
    };

    Workspace.updater("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update();
  }
Beispiel #2
0
  @Test
  public void testUpdateRequest() {
    new NonStrictExpectations() {
      {
        Request request =
            new Request(
                HttpMethod.POST,
                Domains.TASKROUTER.toString(),
                "/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");

        twilioRestClient.request(request);
        times = 1;
        result = new Response("", 500);
        twilioRestClient.getAccountSid();
        result = "AC123";
      }
    };

    try {
      Workspace.updater("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update();
      fail("Expected TwilioException to be thrown for 500");
    } catch (TwilioException e) {
    }
  }