@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 deleteMethod_payment() throws Exception { // Initialize the database method_paymentRepository.saveAndFlush(method_payment); int databaseSizeBeforeDelete = method_paymentRepository.findAll().size(); // Get the method_payment restMethod_paymentMockMvc .perform( delete("/api/method_payments/{id}", method_payment.getId()) .accept(TestUtil.APPLICATION_JSON_UTF8)) .andExpect(status().isOk()); // Validate the database is empty List<Method_payment> method_payments = method_paymentRepository.findAll(); assertThat(method_payments).hasSize(databaseSizeBeforeDelete - 1); }
@Test @Transactional public void checkCreate_dateIsRequired() throws Exception { int databaseSizeBeforeTest = method_paymentRepository.findAll().size(); // set the field null method_payment.setCreate_date(null); // Create the Method_payment, which fails. restMethod_paymentMockMvc .perform( post("/api/method_payments") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(method_payment))) .andExpect(status().isBadRequest()); List<Method_payment> method_payments = method_paymentRepository.findAll(); assertThat(method_payments).hasSize(databaseSizeBeforeTest); }
@Test @Transactional public void createMethod_payment() throws Exception { int databaseSizeBeforeCreate = method_paymentRepository.findAll().size(); // Create the Method_payment restMethod_paymentMockMvc .perform( post("/api/method_payments") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(method_payment))) .andExpect(status().isCreated()); // Validate the Method_payment in the database List<Method_payment> method_payments = method_paymentRepository.findAll(); assertThat(method_payments).hasSize(databaseSizeBeforeCreate + 1); Method_payment testMethod_payment = method_payments.get(method_payments.size() - 1); assertThat(testMethod_payment.getName()).isEqualTo(DEFAULT_NAME); assertThat(testMethod_payment.getDecription()).isEqualTo(DEFAULT_DECRIPTION); assertThat(testMethod_payment.getCreate_date()).isEqualTo(DEFAULT_CREATE_DATE); }