Package com.squareup.okhttp.mockwebserver

Examples of com.squareup.okhttp.mockwebserver.MockWebServer.shutdown()


         assertRequestHasCommonFields(server.takeRequest(), "/ssh_keys/47");
         assertNull(key);
      } finally {
         api.close();
         server.shutdown();
      }
   }

   @Test
   public void testCreateKey() throws Exception {
View Full Code Here


         assertEquals(key.getId(), 47);
         assertEquals(key.getName(), "my_key");
         assertNotNull(key.getPublicKey());
      } finally {
         api.close();
         server.shutdown();
      }
   }

   @Test
   public void testEditKey() throws Exception {
View Full Code Here

         assertEquals(key.getId(), 47);
         assertEquals(key.getName(), "my_key");
         assertNotNull(key.getPublicKey());
      } finally {
         api.close();
         server.shutdown();
      }
   }

   @Test
   public void testEditUnexistingKey() throws Exception {
View Full Code Here

         assertRequestHasParameters(server.takeRequest(), "/ssh_keys/47/edit",
               ImmutableMultimap.of("ssh_pub_key", publicKey));
      } finally {
         api.close();
         server.shutdown();
      }
   }

   @Test
   public void testDeleteKey() throws Exception {
View Full Code Here

         keyPairApi.delete(47);

         assertRequestHasCommonFields(server.takeRequest(), "/ssh_keys/47/destroy");
      } finally {
         api.close();
         server.shutdown();
      }
   }

   @Test
   public void testDeleteUnexistingKey() throws Exception {
View Full Code Here

         }

         assertRequestHasCommonFields(server.takeRequest(), "/ssh_keys/47/destroy");
      } finally {
         api.close();
         server.shutdown();
      }
   }
}
View Full Code Here

         assertRequestHasCommonFields(server.takeRequest(), "/sizes");
         assertEquals(sizes.size(), 4);
      } finally {
         api.close();
         server.shutdown();
      }
   }
}
View Full Code Here

      } catch (Exception ex) {
         assertTrue(ex instanceof AuthorizationException, "Exception should be an AuthorizationException");
         assertEquals(ex.getMessage(), ACCESS_DENIED);
      } finally {
         api.close();
         server.shutdown();
      }
   }

   public void testNotFound() throws Exception {
      MockWebServer server = mockWebServer();
View Full Code Here

      } catch (Exception ex) {
         assertTrue(ex instanceof ResourceNotFoundException, "Exception should be a ResourceNotFoundException");
         assertEquals(ex.getMessage(), NOT_FOUND);
      } finally {
         api.close();
         server.shutdown();
      }
   }

   public void testInternalServerError() throws Exception {
      MockWebServer server = mockWebServer();
View Full Code Here

         HttpResponseException exception = HttpResponseException.class.cast(ex);
         assertEquals(exception.getResponse().getStatusCode(), 500);
         assertEquals(exception.getMessage(), "No Image Found");
      } finally {
         api.close();
         server.shutdown();
      }
   }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.