Ejemplo n.º 1
0
  @Test
  public void debieraActualizarAlmacen() throws Exception {
    log.debug("Debiera actualizar almacen");
    Almacen almacen = new Almacen(Constantes.NOMBRE, Constantes.STATUS_ACTIVO);
    Union union = new Union("test");
    union.setStatus(Constantes.STATUS_ACTIVO);
    currentSession().save(union);
    Asociacion test2 = new Asociacion("test", Constantes.STATUS_ACTIVO, union);
    currentSession().save(test2);

    Asociacion asociacion = new Asociacion("test", Constantes.STATUS_ACTIVO, union);
    currentSession().save(asociacion);
    almacen = almacenDao.crea(almacen);
    assertNotNull(almacen);

    this.mockMvc
        .perform(
            post(Constantes.PATH_ALMACEN_ACTUALIZA)
                .param("id", almacen.getId().toString())
                .param("version", almacen.getVersion().toString())
                .param("clave", "test1")
                .param("nombre", almacen.getNombre())
                .param("asociacion", asociacion.getId().toString())
                .sessionAttr(Constantes.SESSION_ASOCIACION, asociacion))
        .andExpect(status().isOk());
    //  .andExpect(flash().attributeExists(Constantes.CONTAINSKEY_MESSAGE))
    //  .andExpect(flash().attribute(Constantes.CONTAINSKEY_MESSAGE,
    // "almacen.actualizado.message"));
  }
Ejemplo n.º 2
0
  @Test
  public void debieraCrearAlmacen() throws Exception {
    log.debug("Debiera crear almacen");
    Union union = new Union("test");
    union.setStatus(Constantes.STATUS_ACTIVO);
    currentSession().save(union);
    Asociacion test2 = new Asociacion("test", Constantes.STATUS_ACTIVO, union);
    currentSession().save(test2);

    Asociacion asociacion = new Asociacion("test", Constantes.STATUS_ACTIVO, union);
    currentSession().save(asociacion);

    this.mockMvc
        .perform(
            post(Constantes.PATH_ALMACEN_CREA)
                .param("clave", Constantes.CLAVE)
                .param("nombre", Constantes.NOMBRE)
                .param("asociacion", asociacion.getId().toString()))
        .andExpect(status().isOk());
    //   .andExpect(flash().attributeExists(Constantes.CONTAINSKEY_MESSAGE))
    // .andExpect(flash().attribute(Constantes.CONTAINSKEY_MESSAGE, "almacen.creado.message"));
  }