@Test
  public void addPlantillaWithoutNombre() {
    Plantilla plantilla = preparaPlantilla();
    plantilla.setNombre(null);

    ClientResponse response =
        resource.type("application/json").post(ClientResponse.class, plantilla);
    Assert.assertEquals(Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatus());

    ResultatOperacio resultatOperacio = response.getEntity(ResultatOperacio.class);
    Assert.assertEquals(
        CampoRequeridoException.REQUIRED_FIELD + "Nombre", resultatOperacio.getDescripcio());
  }
  @Test
  @Ignore
  public void addPlantilla() {
    Plantilla plantillaPrecios = preparaPlantilla();

    ClientResponse response =
        resource.type("application/json").post(ClientResponse.class, plantillaPrecios);
    Assert.assertEquals(Status.CREATED.getStatusCode(), response.getStatus());
    RestResponse restResponse = response.getEntity(new GenericType<RestResponse>() {});
    Assert.assertTrue(restResponse.getSuccess());
    Assert.assertNotNull(getFieldFromRestResponse(restResponse, "id"));
    Assert.assertEquals(
        plantillaPrecios.getNombre(), getFieldFromRestResponse(restResponse, "nombre"));
  }
  @Test
  @Ignore
  public void updatePlantillaAndRemoveNombre() {
    Plantilla plantilla = preparaPlantilla();
    ClientResponse response =
        resource.type("application/json").post(ClientResponse.class, plantilla);
    Assert.assertEquals(Status.CREATED.getStatusCode(), response.getStatus());
    RestResponse restResponse = response.getEntity(new GenericType<RestResponse>() {});

    String id = getFieldFromRestResponse(restResponse, "id");
    Assert.assertNotNull(id);

    plantilla.setNombre("");
    response = resource.path(id).type("application/json").put(ClientResponse.class, plantilla);
    Assert.assertEquals(Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatus());

    ResultatOperacio parResponseMessage = response.getEntity(ResultatOperacio.class);
    Assert.assertEquals(
        CampoRequeridoException.REQUIRED_FIELD + "Nombre", parResponseMessage.getDescripcio());
  }
  @Test
  @Ignore
  public void updatePlantilla() {
    Plantilla plantilla = preparaPlantilla();
    ClientResponse response =
        resource.type("application/json").post(ClientResponse.class, plantilla);
    Assert.assertEquals(Status.CREATED.getStatusCode(), response.getStatus());
    RestResponse restResponse = response.getEntity(new GenericType<RestResponse>() {});

    String id = getFieldFromRestResponse(restResponse, "id");
    Assert.assertNotNull(id);

    plantilla.setNombre("Prueba2");

    response =
        resource
            .path(String.valueOf(plantilla.getId()))
            .type("application/json")
            .put(ClientResponse.class, plantilla);
    Assert.assertEquals(Status.OK.getStatusCode(), response.getStatus());
    restResponse = response.getEntity(new GenericType<RestResponse>() {});

    Assert.assertEquals(plantilla.getNombre(), getFieldFromRestResponse(restResponse, "nombre"));
  }
  private Plantilla preparaPlantilla() {
    Plantilla plantilla = new Plantilla("Prueba");
    plantilla.setSala(getSala());

    return plantilla;
  }