@Test
  @Transactional
  public void updateBloodPressure() throws Exception {
    // Initialize the database
    bloodPressureRepository.saveAndFlush(bloodPressure);

    int databaseSizeBeforeUpdate = bloodPressureRepository.findAll().size();

    // Update the bloodPressure
    bloodPressure.setTimestamp(UPDATED_TIMESTAMP);
    bloodPressure.setSystolic(UPDATED_SYSTOLIC);
    bloodPressure.setDiastolic(UPDATED_DIASTOLIC);

    restBloodPressureMockMvc
        .perform(
            put("/api/bloodPressures")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(bloodPressure)))
        .andExpect(status().isOk());

    // Validate the BloodPressure in the database
    List<BloodPressure> bloodPressures = bloodPressureRepository.findAll();
    assertThat(bloodPressures).hasSize(databaseSizeBeforeUpdate);
    BloodPressure testBloodPressure = bloodPressures.get(bloodPressures.size() - 1);
    assertThat(testBloodPressure.getTimestamp()).isEqualTo(UPDATED_TIMESTAMP);
    assertThat(testBloodPressure.getSystolic()).isEqualTo(UPDATED_SYSTOLIC);
    assertThat(testBloodPressure.getDiastolic()).isEqualTo(UPDATED_DIASTOLIC);
  }
  @Test
  @Transactional
  public void createJugadores() throws Exception {
    int databaseSizeBeforeCreate = jugadoresRepository.findAll().size();

    // Create the Jugadores

    restJugadoresMockMvc
        .perform(
            post("/api/jugadoress")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(jugadores)))
        .andExpect(status().isCreated());

    // Validate the Jugadores in the database
    List<Jugadores> jugadoress = jugadoresRepository.findAll();
    assertThat(jugadoress).hasSize(databaseSizeBeforeCreate + 1);
    Jugadores testJugadores = jugadoress.get(jugadoress.size() - 1);
    assertThat(testJugadores.getNombreJugador()).isEqualTo(DEFAULT_NOMBRE_JUGADOR);
    assertThat(testJugadores.getFechaNacimiento()).isEqualTo(DEFAULT_FECHA_NACIMIENTO);
    assertThat(testJugadores.getNumCanastas()).isEqualTo(DEFAULT_NUM_CANASTAS);
    assertThat(testJugadores.getNumAsistencias()).isEqualTo(DEFAULT_NUM_ASISTENCIAS);
    assertThat(testJugadores.getNumRebotes()).isEqualTo(DEFAULT_NUM_REBOTES);
    assertThat(testJugadores.getPosicion()).isEqualTo(DEFAULT_POSICION);
  }
  @Test
  @Transactional
  public void updateBill_service() throws Exception {
    // Initialize the database
    bill_serviceRepository.saveAndFlush(bill_service);

    int databaseSizeBeforeUpdate = bill_serviceRepository.findAll().size();

    // Update the bill_service
    bill_service.setQuantity(UPDATED_QUANTITY);
    bill_service.setTotal(UPDATED_TOTAL);
    bill_service.setDecription(UPDATED_DECRIPTION);
    bill_service.setCreate_date(UPDATED_CREATE_DATE);

    restBill_serviceMockMvc
        .perform(
            put("/api/bill_services")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(bill_service)))
        .andExpect(status().isOk());

    // Validate the Bill_service in the database
    List<Bill_service> bill_services = bill_serviceRepository.findAll();
    assertThat(bill_services).hasSize(databaseSizeBeforeUpdate);
    Bill_service testBill_service = bill_services.get(bill_services.size() - 1);
    assertThat(testBill_service.getQuantity()).isEqualTo(UPDATED_QUANTITY);
    assertThat(testBill_service.getTotal()).isEqualTo(UPDATED_TOTAL);
    assertThat(testBill_service.getDecription()).isEqualTo(UPDATED_DECRIPTION);
    assertThat(testBill_service.getCreate_date()).isEqualTo(UPDATED_CREATE_DATE);
  }
  @Test
  @Transactional
  public void createOperation() throws Exception {
    int databaseSizeBeforeCreate = operationRepository.findAll().size();

    // Create the Operation

    restOperationMockMvc
        .perform(
            post("/api/operations")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(operation)))
        .andExpect(status().isCreated());

    // Validate the Operation in the database
    List<Operation> operations = operationRepository.findAll();
    assertThat(operations).hasSize(databaseSizeBeforeCreate + 1);
    Operation testOperation = operations.get(operations.size() - 1);
    assertThat(testOperation.getDate()).isEqualTo(DEFAULT_DATE);
    assertThat(testOperation.getDescription()).isEqualTo(DEFAULT_DESCRIPTION);
    assertThat(testOperation.getAmount()).isEqualTo(DEFAULT_AMOUNT);

    // Validate the Operation in ElasticSearch
    Operation operationEs = operationSearchRepository.findOne(testOperation.getId());
    assertThat(operationEs).isEqualToComparingFieldByField(testOperation);
  }
Example #5
0
  @Test
  @Transactional
  public void updatePayment() throws Exception {
    // Initialize the database
    paymentRepository.saveAndFlush(payment);

    int databaseSizeBeforeUpdate = paymentRepository.findAll().size();

    // Update the payment
    payment.setName(UPDATED_NAME);
    payment.setImage(UPDATED_IMAGE);

    restPaymentMockMvc
        .perform(
            put("/api/payments")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(payment)))
        .andExpect(status().isOk());

    // Validate the Payment in the database
    List<Payment> payments = paymentRepository.findAll();
    assertThat(payments).hasSize(databaseSizeBeforeUpdate);
    Payment testPayment = payments.get(payments.size() - 1);
    assertThat(testPayment.getName()).isEqualTo(UPDATED_NAME);
    assertThat(testPayment.getImage()).isEqualTo(UPDATED_IMAGE);
  }
  @Test
  @Transactional
  public void createOs_type() throws Exception {
    int databaseSizeBeforeCreate = os_typeRepository.findAll().size();

    // Create the Os_type

    restOs_typeMockMvc
        .perform(
            post("/api/os_types")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(os_type)))
        .andExpect(status().isCreated());

    // Validate the Os_type in the database
    List<Os_type> os_types = os_typeRepository.findAll();
    assertThat(os_types).hasSize(databaseSizeBeforeCreate + 1);
    Os_type testOs_type = os_types.get(os_types.size() - 1);
    assertThat(testOs_type.getOs_type_name()).isEqualTo(DEFAULT_OS_TYPE_NAME);
    assertThat(testOs_type.getDescription()).isEqualTo(DEFAULT_DESCRIPTION);
    assertThat(testOs_type.getStatus_id()).isEqualTo(DEFAULT_STATUS_ID);
    assertThat(testOs_type.getCreated_by()).isEqualTo(DEFAULT_CREATED_BY);
    assertThat(testOs_type.getCreated_date()).isEqualTo(DEFAULT_CREATED_DATE);
    assertThat(testOs_type.getModified_by()).isEqualTo(DEFAULT_MODIFIED_BY);
    assertThat(testOs_type.getModified_date()).isEqualTo(DEFAULT_MODIFIED_DATE);
  }
  @Test
  @Transactional
  public void updateHotel() throws Exception {
    // Initialize the database
    hotelRepository.saveAndFlush(hotel);

    int databaseSizeBeforeUpdate = hotelRepository.findAll().size();

    // Update the hotel
    hotel.setName(UPDATED_NAME);
    hotel.setCode(UPDATED_CODE);

    restHotelMockMvc
        .perform(
            put("/api/hotels")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(hotel)))
        .andExpect(status().isOk());

    // Validate the Hotel in the database
    List<Hotel> hotels = hotelRepository.findAll();
    assertThat(hotels).hasSize(databaseSizeBeforeUpdate);
    Hotel testHotel = hotels.get(hotels.size() - 1);
    assertThat(testHotel.getName()).isEqualTo(UPDATED_NAME);
    assertThat(testHotel.getCode()).isEqualTo(UPDATED_CODE);
  }
  @Test
  @Transactional
  public void updateCoupon() throws Exception {
    // Initialize the database
    couponRepository.saveAndFlush(coupon);

    int databaseSizeBeforeUpdate = couponRepository.findAll().size();

    // Update the coupon
    coupon.setCode(UPDATED_CODE);
    coupon.setPassword(UPDATED_PASSWORD);
    coupon.setCategory(UPDATED_CATEGORY);
    coupon.setStatus(STATUS.Unused);
    restCouponMockMvc
        .perform(
            put("/api/coupons")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(coupon)))
        .andExpect(status().isOk());

    // Validate the Coupon in the database
    List<Coupon> coupons = couponRepository.findAll();
    assertThat(coupons).hasSize(databaseSizeBeforeUpdate);
    Coupon testCoupon = coupons.get(coupons.size() - 1);
    assertThat(testCoupon.getCode()).isEqualTo(UPDATED_CODE);
    assertThat(testCoupon.getPassword()).isEqualTo(UPDATED_PASSWORD);
    assertThat(testCoupon.getCategory()).isEqualTo(UPDATED_CATEGORY);
    assertThat(testCoupon.getStatus()).isEqualTo(UPDATED_STATUS);
  }
  @Test
  @Transactional
  public void createForum() throws Exception {
    int databaseSizeBeforeCreate = forumRepository.findAll().size();

    // Create the Forum
    restForumMockMvc
        .perform(
            post("/api/forums")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(forum)))
        .andExpect(status().isCreated());

    // Validate the Forum in the database
    List<Forum> forums = forumRepository.findAll();
    assertThat(forums).hasSize(databaseSizeBeforeCreate + 1);
    Forum testForum = forums.get(forums.size() - 1);
    assertThat(testForum.getName()).isEqualTo(DEFAULT_NAME);
    assertThat(testForum.getDescription()).isEqualTo(DEFAULT_DESCRIPTION);
    assertThat(testForum.getDisplay()).isEqualTo(DEFAULT_DISPLAY);
    assertThat(testForum.getLft()).isEqualTo(DEFAULT_LFT);
    assertThat(testForum.getRgt()).isEqualTo(DEFAULT_RGT);
    assertThat(testForum.getPostCount()).isEqualTo(DEFAULT_POST_COUNT);
    assertThat(testForum.getTopicCount()).isEqualTo(DEFAULT_TOPIC_COUNT);
    assertThat(testForum.getLocked()).isEqualTo(DEFAULT_LOCKED);
  }
  @Test
  @Transactional
  public void updateMethod_payment() throws Exception {
    // Initialize the database
    method_paymentRepository.saveAndFlush(method_payment);

    int databaseSizeBeforeUpdate = method_paymentRepository.findAll().size();

    // Update the method_payment
    method_payment.setName(UPDATED_NAME);
    method_payment.setDecription(UPDATED_DECRIPTION);
    method_payment.setCreate_date(UPDATED_CREATE_DATE);

    restMethod_paymentMockMvc
        .perform(
            put("/api/method_payments")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(method_payment)))
        .andExpect(status().isOk());

    // Validate the Method_payment in the database
    List<Method_payment> method_payments = method_paymentRepository.findAll();
    assertThat(method_payments).hasSize(databaseSizeBeforeUpdate);
    Method_payment testMethod_payment = method_payments.get(method_payments.size() - 1);
    assertThat(testMethod_payment.getName()).isEqualTo(UPDATED_NAME);
    assertThat(testMethod_payment.getDecription()).isEqualTo(UPDATED_DECRIPTION);
    assertThat(testMethod_payment.getCreate_date()).isEqualTo(UPDATED_CREATE_DATE);
  }
  @Test
  @Transactional
  public void updateSocio() throws Exception {
    // Initialize the database
    socioRepository.saveAndFlush(socio);

    int databaseSizeBeforeUpdate = socioRepository.findAll().size();

    // Update the socio
    socio.setNombre(UPDATED_NOMBRE);
    socio.setFechaNacimiento(UPDATED_FECHA_NACIMIENTO);
    socio.setEquipo(UPDATED_EQUIPO);

    restSocioMockMvc
        .perform(
            put("/api/socios")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(socio)))
        .andExpect(status().isOk());

    // Validate the Socio in the database
    List<Socio> socios = socioRepository.findAll();
    assertThat(socios).hasSize(databaseSizeBeforeUpdate);
    Socio testSocio = socios.get(socios.size() - 1);
    assertThat(testSocio.getNombre()).isEqualTo(UPDATED_NOMBRE);
    assertThat(testSocio.getFechaNacimiento()).isEqualTo(UPDATED_FECHA_NACIMIENTO);
    assertThat(testSocio.getEquipo()).isEqualTo(UPDATED_EQUIPO);
  }
  @Test
  @Transactional
  public void updateBankAccount() throws Exception {
    // Initialize the database
    bankAccountRepository.saveAndFlush(bankAccount);
    int databaseSizeBeforeUpdate = bankAccountRepository.findAll().size();

    // Update the bankAccount
    BankAccount updatedBankAccount = bankAccountRepository.findOne(bankAccount.getId());
    updatedBankAccount.setName(UPDATED_NAME);
    updatedBankAccount.setBalance(UPDATED_BALANCE);

    restBankAccountMockMvc
        .perform(
            put("/api/bank-accounts")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(updatedBankAccount)))
        .andExpect(status().isOk());

    // Validate the BankAccount in the database
    List<BankAccount> bankAccountList = bankAccountRepository.findAll();
    assertThat(bankAccountList).hasSize(databaseSizeBeforeUpdate);
    BankAccount testBankAccount = bankAccountList.get(bankAccountList.size() - 1);
    assertThat(testBankAccount.getName()).isEqualTo(UPDATED_NAME);
    assertThat(testBankAccount.getBalance()).isEqualTo(UPDATED_BALANCE);
  }
  @Test
  @Transactional
  public void updateAluno() throws Exception {
    // Initialize the database
    alunoRepository.saveAndFlush(aluno);

    int databaseSizeBeforeUpdate = alunoRepository.findAll().size();

    // Update the aluno
    aluno.setNome(UPDATED_NOME);
    aluno.setCpf(UPDATED_CPF);
    aluno.setEndereco(UPDATED_ENDERECO);

    restAlunoMockMvc
        .perform(
            put("/api/alunos")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(aluno)))
        .andExpect(status().isOk());

    // Validate the Aluno in the database
    List<Aluno> alunos = alunoRepository.findAll();
    assertThat(alunos).hasSize(databaseSizeBeforeUpdate);
    Aluno testAluno = alunos.get(alunos.size() - 1);
    assertThat(testAluno.getNome()).isEqualTo(UPDATED_NOME);
    assertThat(testAluno.getCpf()).isEqualTo(UPDATED_CPF);
    assertThat(testAluno.getEndereco()).isEqualTo(UPDATED_ENDERECO);
  }
  @Test
  @Transactional
  public void createRegister_info() throws Exception {
    int databaseSizeBeforeCreate = register_infoRepository.findAll().size();

    // Create the Register_info

    restRegister_infoMockMvc
        .perform(
            post("/api/register_infos")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(register_info)))
        .andExpect(status().isCreated());

    // Validate the Register_info in the database
    List<Register_info> register_infos = register_infoRepository.findAll();
    assertThat(register_infos).hasSize(databaseSizeBeforeCreate + 1);
    Register_info testRegister_info = register_infos.get(register_infos.size() - 1);
    assertThat(testRegister_info.getDate_checkin()).isEqualTo(DEFAULT_DATE_CHECKIN);
    assertThat(testRegister_info.getDate_checkout()).isEqualTo(DEFAULT_DATE_CHECKOUT);
    assertThat(testRegister_info.getNumber_of_adult()).isEqualTo(DEFAULT_NUMBER_OF_ADULT);
    assertThat(testRegister_info.getNumber_of_kid()).isEqualTo(DEFAULT_NUMBER_OF_KID);
    assertThat(testRegister_info.getOther_request()).isEqualTo(DEFAULT_OTHER_REQUEST);
    assertThat(testRegister_info.getDeposit_value()).isEqualTo(DEFAULT_DEPOSIT_VALUE);
    assertThat(testRegister_info.getCreate_date()).isEqualTo(DEFAULT_CREATE_DATE);
    assertThat(testRegister_info.getLast_modified_date()).isEqualTo(DEFAULT_LAST_MODIFIED_DATE);
  }
  @Test
  @Transactional
  public void updateEntry() throws Exception {
    // Initialize the database
    entryRepository.saveAndFlush(entry);

    int databaseSizeBeforeUpdate = entryRepository.findAll().size();

    // Update the entry
    entry.setDate(UPDATED_DATE);
    entry.setExercise(UPDATED_EXERCISE);
    entry.setMeals(UPDATED_MEALS);
    entry.setAlcohol(UPDATED_ALCOHOL);
    entry.setNotes(UPDATED_NOTES);

    restEntryMockMvc
        .perform(
            put("/api/entrys")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(entry)))
        .andExpect(status().isOk());

    // Validate the Entry in the database
    List<Entry> entrys = entryRepository.findAll();
    assertThat(entrys).hasSize(databaseSizeBeforeUpdate);
    Entry testEntry = entrys.get(entrys.size() - 1);
    assertThat(testEntry.getDate()).isEqualTo(UPDATED_DATE);
    assertThat(testEntry.getExercise()).isEqualTo(UPDATED_EXERCISE);
    assertThat(testEntry.getMeals()).isEqualTo(UPDATED_MEALS);
    assertThat(testEntry.getAlcohol()).isEqualTo(UPDATED_ALCOHOL);
    assertThat(testEntry.getNotes()).isEqualTo(UPDATED_NOTES);
  }
  @Test
  @Transactional
  public void updatePhysiotherapist() throws Exception {
    // Initialize the database
    physiotherapistRepository.saveAndFlush(physiotherapist);

    int databaseSizeBeforeUpdate = physiotherapistRepository.findAll().size();

    // Update the physiotherapist
    physiotherapist.setFirstName(UPDATED_FIRST_NAME);
    physiotherapist.setLastName(UPDATED_LAST_NAME);
    physiotherapist.setStreet(UPDATED_STREET);
    physiotherapist.setPostalCode(UPDATED_POSTAL_CODE);
    physiotherapist.setCity(UPDATED_CITY);
    physiotherapist.setCountry(UPDATED_COUNTRY);

    restPhysiotherapistMockMvc
        .perform(
            put("/api/physiotherapists")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(physiotherapist)))
        .andExpect(status().isOk());

    // Validate the Physiotherapist in the database
    List<Physiotherapist> physiotherapists = physiotherapistRepository.findAll();
    assertThat(physiotherapists).hasSize(databaseSizeBeforeUpdate);
    Physiotherapist testPhysiotherapist = physiotherapists.get(physiotherapists.size() - 1);
    assertThat(testPhysiotherapist.getFirstName()).isEqualTo(UPDATED_FIRST_NAME);
    assertThat(testPhysiotherapist.getLastName()).isEqualTo(UPDATED_LAST_NAME);
    assertThat(testPhysiotherapist.getStreet()).isEqualTo(UPDATED_STREET);
    assertThat(testPhysiotherapist.getPostalCode()).isEqualTo(UPDATED_POSTAL_CODE);
    assertThat(testPhysiotherapist.getCity()).isEqualTo(UPDATED_CITY);
    assertThat(testPhysiotherapist.getCountry()).isEqualTo(UPDATED_COUNTRY);
  }
  @Test
  @Transactional
  public void updateAccountFamily() throws Exception {
    // Initialize the database
    accountFamilyRepository.saveAndFlush(accountFamily);

    int databaseSizeBeforeUpdate = accountFamilyRepository.findAll().size();

    // Update the accountFamily
    accountFamily.setAccountFamilyCode(UPDATED_ACCOUNT_FAMILY_CODE);
    accountFamily.setAccountFamilyDesc(UPDATED_ACCOUNT_FAMILY_DESC);
    AccountFamilyDTO accountFamilyDTO =
        accountFamilyMapper.accountFamilyToAccountFamilyDTO(accountFamily);

    restAccountFamilyMockMvc
        .perform(
            put("/api/accountFamilys")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(accountFamilyDTO)))
        .andExpect(status().isOk());

    // Validate the AccountFamily in the database
    List<AccountFamily> accountFamilys = accountFamilyRepository.findAll();
    assertThat(accountFamilys).hasSize(databaseSizeBeforeUpdate);
    AccountFamily testAccountFamily = accountFamilys.get(accountFamilys.size() - 1);
    assertThat(testAccountFamily.getAccountFamilyCode()).isEqualTo(UPDATED_ACCOUNT_FAMILY_CODE);
    assertThat(testAccountFamily.getAccountFamilyDesc()).isEqualTo(UPDATED_ACCOUNT_FAMILY_DESC);
  }
  @Test
  @Transactional
  public void createPhysiotherapist() throws Exception {
    int databaseSizeBeforeCreate = physiotherapistRepository.findAll().size();

    // Create the Physiotherapist

    restPhysiotherapistMockMvc
        .perform(
            post("/api/physiotherapists")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(physiotherapist)))
        .andExpect(status().isCreated());

    // Validate the Physiotherapist in the database
    List<Physiotherapist> physiotherapists = physiotherapistRepository.findAll();
    assertThat(physiotherapists).hasSize(databaseSizeBeforeCreate + 1);
    Physiotherapist testPhysiotherapist = physiotherapists.get(physiotherapists.size() - 1);
    assertThat(testPhysiotherapist.getFirstName()).isEqualTo(DEFAULT_FIRST_NAME);
    assertThat(testPhysiotherapist.getLastName()).isEqualTo(DEFAULT_LAST_NAME);
    assertThat(testPhysiotherapist.getStreet()).isEqualTo(DEFAULT_STREET);
    assertThat(testPhysiotherapist.getPostalCode()).isEqualTo(DEFAULT_POSTAL_CODE);
    assertThat(testPhysiotherapist.getCity()).isEqualTo(DEFAULT_CITY);
    assertThat(testPhysiotherapist.getCountry()).isEqualTo(DEFAULT_COUNTRY);
  }
  @Test
  @Transactional
  public void updateStudent() throws Exception {
    // Initialize the database
    studentRepository.saveAndFlush(student);

    int databaseSizeBeforeUpdate = studentRepository.findAll().size();

    // Update the student
    student.setSid(UPDATED_SID);
    student.setLastName(UPDATED_LAST_NAME);
    student.setFirstName(UPDATED_FIRST_NAME);
    student.setEmail(UPDATED_EMAIL);
    student.setPhone(UPDATED_PHONE);

    restStudentMockMvc
        .perform(
            put("/api/students")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(student)))
        .andExpect(status().isOk());

    // Validate the Student in the database
    List<Student> students = studentRepository.findAll();
    assertThat(students).hasSize(databaseSizeBeforeUpdate);
    Student testStudent = students.get(students.size() - 1);
    assertThat(testStudent.getSid()).isEqualTo(UPDATED_SID);
    assertThat(testStudent.getLastName()).isEqualTo(UPDATED_LAST_NAME);
    assertThat(testStudent.getFirstName()).isEqualTo(UPDATED_FIRST_NAME);
    assertThat(testStudent.getEmail()).isEqualTo(UPDATED_EMAIL);
    assertThat(testStudent.getPhone()).isEqualTo(UPDATED_PHONE);
  }
  @Test
  @Transactional
  public void updateShipOrder() throws Exception {
    // Initialize the database
    shipOrderRepository.saveAndFlush(shipOrder);

    int databaseSizeBeforeUpdate = shipOrderRepository.findAll().size();

    // Update the shipOrder
    shipOrder.setDeliveryTimeStamp(UPDATED_DELIVERY_TIME_STAMP);
    shipOrder.setFinalCosts(UPDATED_FINAL_COSTS);
    shipOrder.setReadyForShipping(UPDATED_READY_FOR_SHIPPING);

    restShipOrderMockMvc
        .perform(
            put("/api/shipOrders")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(shipOrder)))
        .andExpect(status().isOk());

    // Validate the ShipOrder in the database
    List<ShipOrder> shipOrders = shipOrderRepository.findAll();
    assertThat(shipOrders).hasSize(databaseSizeBeforeUpdate);
    ShipOrder testShipOrder = shipOrders.get(shipOrders.size() - 1);
    assertThat(testShipOrder.getDeliveryTimeStamp()).isEqualTo(UPDATED_DELIVERY_TIME_STAMP);
    assertThat(testShipOrder.getFinalCosts()).isEqualTo(UPDATED_FINAL_COSTS);
    assertThat(testShipOrder.getReadyForShipping()).isEqualTo(UPDATED_READY_FOR_SHIPPING);
  }
  @Test
  @Transactional
  public void updateAuthor() throws Exception {
    // Initialize the database
    authorRepository.saveAndFlush(author);

    int databaseSizeBeforeUpdate = authorRepository.findAll().size();

    // Update the author
    author.setName(UPDATED_NAME);
    author.setSurname(UPDATED_SURNAME);
    author.setDescription(UPDATED_DESCRIPTION);
    author.setBirthDate(UPDATED_BIRTH_DATE);
    restAuthorMockMvc
        .perform(
            put("/api/authors")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(author)))
        .andExpect(status().isOk());

    // Validate the Author in the database
    List<Author> authors = authorRepository.findAll();
    assertThat(authors).hasSize(databaseSizeBeforeUpdate);
    Author testAuthor = authors.get(authors.size() - 1);
    assertThat(testAuthor.getName()).isEqualTo(UPDATED_NAME);
    assertThat(testAuthor.getSurname()).isEqualTo(UPDATED_SURNAME);
    assertThat(testAuthor.getDescription()).isEqualTo(UPDATED_DESCRIPTION);
    assertThat(testAuthor.getBirthDate()).isEqualTo(UPDATED_BIRTH_DATE);
  }
  @Test
  @Transactional
  public void updateLocation() throws Exception {
    // Initialize the database
    locationRepository.saveAndFlush(location);

    int databaseSizeBeforeUpdate = locationRepository.findAll().size();

    // Update the location
    location.setAddressLine1(UPDATED_ADDRESS_LINE1);
    location.setAddressLine2(UPDATED_ADDRESS_LINE2);
    location.setAddressLine3(UPDATED_ADDRESS_LINE3);
    location.setLongitude(UPDATED_LONGITUDE);
    location.setLatitude(UPDATED_LATITUDE);
    location.setZipCode(UPDATED_ZIP_CODE);

    restLocationMockMvc
        .perform(
            put("/api/locations")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(location)))
        .andExpect(status().isOk());

    // Validate the Location in the database
    List<Location> locations = locationRepository.findAll();
    assertThat(locations).hasSize(databaseSizeBeforeUpdate);
    Location testLocation = locations.get(locations.size() - 1);
    assertThat(testLocation.getAddressLine1()).isEqualTo(UPDATED_ADDRESS_LINE1);
    assertThat(testLocation.getAddressLine2()).isEqualTo(UPDATED_ADDRESS_LINE2);
    assertThat(testLocation.getAddressLine3()).isEqualTo(UPDATED_ADDRESS_LINE3);
    assertThat(testLocation.getLongitude()).isEqualTo(UPDATED_LONGITUDE);
    assertThat(testLocation.getLatitude()).isEqualTo(UPDATED_LATITUDE);
    assertThat(testLocation.getZipCode()).isEqualTo(UPDATED_ZIP_CODE);
  }
  @Test
  @Transactional
  public void updateOperation() throws Exception {
    // Initialize the database
    operationRepository.saveAndFlush(operation);
    operationSearchRepository.save(operation);
    int databaseSizeBeforeUpdate = operationRepository.findAll().size();

    // Update the operation
    Operation updatedOperation = operationRepository.findOne(operation.getId());
    updatedOperation.setDate(UPDATED_DATE);
    updatedOperation.setDescription(UPDATED_DESCRIPTION);
    updatedOperation.setAmount(UPDATED_AMOUNT);

    restOperationMockMvc
        .perform(
            put("/api/operations")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(updatedOperation)))
        .andExpect(status().isOk());

    // Validate the Operation in the database
    List<Operation> operations = operationRepository.findAll();
    assertThat(operations).hasSize(databaseSizeBeforeUpdate);
    Operation testOperation = operations.get(operations.size() - 1);
    assertThat(testOperation.getDate()).isEqualTo(UPDATED_DATE);
    assertThat(testOperation.getDescription()).isEqualTo(UPDATED_DESCRIPTION);
    assertThat(testOperation.getAmount()).isEqualTo(UPDATED_AMOUNT);

    // Validate the Operation in ElasticSearch
    Operation operationEs = operationSearchRepository.findOne(testOperation.getId());
    assertThat(operationEs).isEqualToComparingFieldByField(testOperation);
  }
  @Test
  @Transactional
  public void createLocation() throws Exception {
    int databaseSizeBeforeCreate = locationRepository.findAll().size();

    // Create the Location

    restLocationMockMvc
        .perform(
            post("/api/locations")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(location)))
        .andExpect(status().isCreated());

    // Validate the Location in the database
    List<Location> locations = locationRepository.findAll();
    assertThat(locations).hasSize(databaseSizeBeforeCreate + 1);
    Location testLocation = locations.get(locations.size() - 1);
    assertThat(testLocation.getAddressLine1()).isEqualTo(DEFAULT_ADDRESS_LINE1);
    assertThat(testLocation.getAddressLine2()).isEqualTo(DEFAULT_ADDRESS_LINE2);
    assertThat(testLocation.getAddressLine3()).isEqualTo(DEFAULT_ADDRESS_LINE3);
    assertThat(testLocation.getLongitude()).isEqualTo(DEFAULT_LONGITUDE);
    assertThat(testLocation.getLatitude()).isEqualTo(DEFAULT_LATITUDE);
    assertThat(testLocation.getZipCode()).isEqualTo(DEFAULT_ZIP_CODE);
  }
  @Test
  @Transactional
  public void updateJugadores() throws Exception {
    // Initialize the database
    jugadoresRepository.saveAndFlush(jugadores);

    int databaseSizeBeforeUpdate = jugadoresRepository.findAll().size();

    // Update the jugadores
    jugadores.setNombreJugador(UPDATED_NOMBRE_JUGADOR);
    jugadores.setFechaNacimiento(UPDATED_FECHA_NACIMIENTO);
    jugadores.setNumCanastas(UPDATED_NUM_CANASTAS);
    jugadores.setNumAsistencias(UPDATED_NUM_ASISTENCIAS);
    jugadores.setNumRebotes(UPDATED_NUM_REBOTES);
    jugadores.setPosicion(UPDATED_POSICION);

    restJugadoresMockMvc
        .perform(
            put("/api/jugadoress")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(jugadores)))
        .andExpect(status().isOk());

    // Validate the Jugadores in the database
    List<Jugadores> jugadoress = jugadoresRepository.findAll();
    assertThat(jugadoress).hasSize(databaseSizeBeforeUpdate);
    Jugadores testJugadores = jugadoress.get(jugadoress.size() - 1);
    assertThat(testJugadores.getNombreJugador()).isEqualTo(UPDATED_NOMBRE_JUGADOR);
    assertThat(testJugadores.getFechaNacimiento()).isEqualTo(UPDATED_FECHA_NACIMIENTO);
    assertThat(testJugadores.getNumCanastas()).isEqualTo(UPDATED_NUM_CANASTAS);
    assertThat(testJugadores.getNumAsistencias()).isEqualTo(UPDATED_NUM_ASISTENCIAS);
    assertThat(testJugadores.getNumRebotes()).isEqualTo(UPDATED_NUM_REBOTES);
    assertThat(testJugadores.getPosicion()).isEqualTo(UPDATED_POSICION);
  }
  @Test
  public void updatePicture() throws Exception {
    // Initialize the database
    pictureRepository.save(picture);

    int databaseSizeBeforeUpdate = pictureRepository.findAll().size();

    // Update the picture
    picture.setTitle(UPDATED_TITLE);
    picture.setDescription(UPDATED_DESCRIPTION);
    picture.setPictureFile(ByteBuffer.wrap(UPDATED_PICTURE_FILE));

    picture.setCreated(UPDATED_CREATED);
    picture.setModified(UPDATED_MODIFIED);

    PictureDTO pictureDTO = pictureMapper.pictureToPictureDTO(picture);

    restPictureMockMvc
        .perform(
            put("/api/pictures")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(pictureDTO)))
        .andExpect(status().isOk());

    // Validate the Picture in the database
    List<Picture> pictures = pictureRepository.findAll();
    assertThat(pictures).hasSize(databaseSizeBeforeUpdate);
    Picture testPicture = pictures.get(pictures.size() - 1);
    assertThat(testPicture.getTitle()).isEqualTo(UPDATED_TITLE);
    assertThat(testPicture.getDescription()).isEqualTo(UPDATED_DESCRIPTION);
    assertThat(testPicture.getPictureFile()).isEqualTo(UPDATED_PICTURE_FILE);

    assertThat(testPicture.getCreated()).isEqualTo(UPDATED_CREATED);
    assertThat(testPicture.getModified()).isEqualTo(UPDATED_MODIFIED);
  }
  @Test
  public void updateBook() throws Exception {
    // Initialize the database
    bookRepository.save(book);

    int databaseSizeBeforeUpdate = bookRepository.findAll().size();

    // Update the book
    book.setTitle(UPDATED_TITLE);
    book.setDescription(UPDATED_DESCRIPTION);
    book.setPublisher(UPDATED_PUBLISHER);
    book.setPublicationDate(UPDATED_PUBLICATION_DATE);
    book.setPrice(UPDATED_PRICE);

    restBookMockMvc
        .perform(
            put("/api/books")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(book)))
        .andExpect(status().isOk());

    // Validate the Book in the database
    List<Book> books = bookRepository.findAll();
    assertThat(books).hasSize(databaseSizeBeforeUpdate);
    Book testBook = books.get(books.size() - 1);
    assertThat(testBook.getTitle()).isEqualTo(UPDATED_TITLE);
    assertThat(testBook.getDescription()).isEqualTo(UPDATED_DESCRIPTION);
    assertThat(testBook.getPublisher()).isEqualTo(UPDATED_PUBLISHER);
    assertThat(testBook.getPublicationDate()).isEqualTo(UPDATED_PUBLICATION_DATE);
    assertThat(testBook.getPrice()).isEqualTo(UPDATED_PRICE);
  }
  @Test
  public void createPicture() throws Exception {
    int databaseSizeBeforeCreate = pictureRepository.findAll().size();

    // Create the Picture
    PictureDTO pictureDTO = pictureMapper.pictureToPictureDTO(picture);

    restPictureMockMvc
        .perform(
            post("/api/pictures")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(pictureDTO)))
        .andExpect(status().isCreated());

    // Validate the Picture in the database
    List<Picture> pictures = pictureRepository.findAll();
    assertThat(pictures).hasSize(databaseSizeBeforeCreate + 1);
    Picture testPicture = pictures.get(pictures.size() - 1);
    assertThat(testPicture.getTitle()).isEqualTo(DEFAULT_TITLE);
    assertThat(testPicture.getDescription()).isEqualTo(DEFAULT_DESCRIPTION);
    assertThat(testPicture.getPictureFile()).isEqualTo(DEFAULT_PICTURE_FILE);

    assertThat(testPicture.getCreated()).isEqualTo(DEFAULT_CREATED);
    assertThat(testPicture.getModified()).isEqualTo(DEFAULT_MODIFIED);
  }
Example #29
0
  @Test
  @Transactional
  public void testRegisterAdminIsIgnored() throws Exception {
    UserDTO u =
        new UserDTO(
            "badguy", // login
            "password", // password
            "Bad", // firstName
            "Guy", // lastName
            "*****@*****.**", // e-mail
            true, // activated
            "en", // langKey
            new HashSet<>(
                Arrays.asList(
                    AuthoritiesConstants.ADMIN)) // <-- only admin should be able to do that
            );

    restMvc
        .perform(
            post("/api/register")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(u)))
        .andExpect(status().isCreated());

    Optional<User> userDup = userRepository.findOneByLogin("badguy");
    assertThat(userDup.isPresent()).isTrue();
    assertThat(userDup.get().getAuthorities())
        .hasSize(1)
        .containsExactly(authorityRepository.findOne(AuthoritiesConstants.USER));
  }
  @Test
  @Transactional
  public void updateClasseType() throws Exception {
    // Initialize the database
    classeTypeRepository.saveAndFlush(classeType);

    int databaseSizeBeforeUpdate = classeTypeRepository.findAll().size();

    // Update the classeType
    classeType.setIntitule(UPDATED_INTITULE);
    classeType.setDateCreation(UPDATED_DATE_CREATION);

    restClasseTypeMockMvc
        .perform(
            put("/api/classeTypes")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(classeType)))
        .andExpect(status().isOk());

    // Validate the ClasseType in the database
    List<ClasseType> classeTypes = classeTypeRepository.findAll();
    assertThat(classeTypes).hasSize(databaseSizeBeforeUpdate);
    ClasseType testClasseType = classeTypes.get(classeTypes.size() - 1);
    assertThat(testClasseType.getIntitule()).isEqualTo(UPDATED_INTITULE);
    assertThat(testClasseType.getDateCreation()).isEqualTo(UPDATED_DATE_CREATION);
  }