コード例 #1
0
 @Test
 public void shouldUnmarshallSingleValidOptionInResponseBody() throws Throwable {
   // pre-conditions
   String content = Samples.ADD_APPLICATION_CARTRIDGE_JSON.getContentAsString();
   assertNotNull(content);
   // operation
   RestResponse response = ResourceDTOFactory.get(content);
   // verifications
   final CartridgeResourceDTO cartridge = response.getData();
   final Link link = cartridge.getLink("RESTART");
   assertThat(link.getOptionalParams()).hasSize(0);
   assertThat(link.getRequiredParams().get(0).getValidOptions()).containsExactly("restart");
 }
コード例 #2
0
 /**
  * Should unmarshall get application response body.
  *
  * @throws Throwable
  */
 @Test
 public void shouldUnmarshallAddApplicationEmbeddedCartridgeResponseBody() throws Throwable {
   // pre-conditions
   String content = Samples.ADD_APPLICATION_CARTRIDGE_JSON.getContentAsString();
   assertNotNull(content);
   // operation
   RestResponse response = ResourceDTOFactory.get(content);
   // verifications
   assertThat(response.getMessages()).hasSize(3);
   assertThat(response.getDataType()).isEqualTo(EnumDataType.cartridge);
   final CartridgeResourceDTO cartridge = response.getData();
   assertThat(cartridge.getName()).isEqualTo("mysql-5.1");
   assertThat(cartridge.getType()).isEqualTo(CartridgeType.EMBEDDED);
   assertThat(cartridge.getLinks()).hasSize(6);
 }