/**
   * Update Push Application
   *
   * @param pushApplicationID id of {@link PushApplication}
   * @param updatedPushApp new info of {@link PushApplication}
   * @statuscode 204 The PushApplication updated successfully
   * @statuscode 400 The format of the client request was incorrect
   * @statuscode 404 The requested PushApplication resource does not exist
   */
  @PUT
  @Path("/{pushAppID}")
  @Consumes(MediaType.APPLICATION_JSON)
  @Produces(MediaType.APPLICATION_JSON)
  @ReturnType("java.lang.Void")
  public Response updatePushApplication(
      @PathParam("pushAppID") String pushApplicationID, PushApplication updatedPushApp) {

    PushApplication pushApp = getSearch().findByPushApplicationIDForDeveloper(pushApplicationID);

    if (pushApp != null) {

      // some validation
      try {
        validateModelClass(updatedPushApp);
      } catch (ConstraintViolationException cve) {

        // Build and return the 400 (Bad Request) response
        ResponseBuilder builder = createBadRequestResponse(cve.getConstraintViolations());

        return builder.build();
      }

      // update name/desc:
      pushApp.setDescription(updatedPushApp.getDescription());
      pushApp.setName(updatedPushApp.getName());
      pushAppService.updatePushApplication(pushApp);

      return Response.noContent().build();
    }

    return Response.status(Status.NOT_FOUND)
        .entity("Could not find requested PushApplicationEntity")
        .build();
  }
  @Test
  public void updatePushApplication() {
    final String pushApplicationID1 = "888";

    final PushApplication pushApplication1 =
        pushApplicationDao.findByPushApplicationID(pushApplicationID1);
    assertThat(pushApplication1).isNotNull();
    assertThat(pushApplication1.getName()).isEqualTo("Push App 1");

    pushApplication1.setName("Cool Push App 1");
    pushApplicationDao.update(pushApplication1);

    assertThat(pushApplicationDao.findByPushApplicationID(pushApplicationID1)).isNotNull();
    assertThat(pushApplicationDao.findByPushApplicationID(pushApplicationID1).getName())
        .isEqualTo("Cool Push App 1");
  }
  @Test
  public void primaryKeyUnmodifiedAfterUpdate() {
    final String id = "1";
    PushApplication pa = pushApplicationDao.find(id);

    assertThat(pa.getId()).isEqualTo(id);

    final PushApplication pushApplication1 =
        pushApplicationDao.findByPushApplicationID(pa.getPushApplicationID());
    pushApplication1.setName("Cool Push App 1");
    pushApplicationDao.update(pushApplication1);

    entityManager.flush();
    entityManager.clear();

    pa = pushApplicationDao.find(id);

    assertThat(pa.getName()).isEqualTo("Cool Push App 1");
  }