use of io.github.jhipster.sample.domain.BankAccount in project jhipster-sample-app-elasticsearch by jhipster.
the class BankAccountResourceIntTest method equalsVerifier.
@Test
@Transactional
public void equalsVerifier() throws Exception {
TestUtil.equalsVerifier(BankAccount.class);
BankAccount bankAccount1 = new BankAccount();
bankAccount1.setId(1L);
BankAccount bankAccount2 = new BankAccount();
bankAccount2.setId(bankAccount1.getId());
assertThat(bankAccount1).isEqualTo(bankAccount2);
bankAccount2.setId(2L);
assertThat(bankAccount1).isNotEqualTo(bankAccount2);
bankAccount1.setId(null);
assertThat(bankAccount1).isNotEqualTo(bankAccount2);
}
use of io.github.jhipster.sample.domain.BankAccount in project jhipster-sample-app-elasticsearch by jhipster.
the class BankAccountResourceIntTest method updateBankAccount.
@Test
@Transactional
public void updateBankAccount() throws Exception {
// Initialize the database
bankAccountRepository.saveAndFlush(bankAccount);
int databaseSizeBeforeUpdate = bankAccountRepository.findAll().size();
// Update the bankAccount
BankAccount updatedBankAccount = bankAccountRepository.findById(bankAccount.getId()).get();
// Disconnect from session so that the updates on updatedBankAccount are not directly saved in db
em.detach(updatedBankAccount);
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);
// Validate the BankAccount in Elasticsearch
verify(mockBankAccountSearchRepository, times(1)).save(testBankAccount);
}
use of io.github.jhipster.sample.domain.BankAccount in project jhipster-sample-app-elasticsearch by jhipster.
the class BankAccountResourceIntTest method createEntity.
/**
* Create an entity for this test.
*
* This is a static method, as tests for other entities might also need it,
* if they test an entity which requires the current entity.
*/
public static BankAccount createEntity(EntityManager em) {
BankAccount bankAccount = new BankAccount();
bankAccount.setName(DEFAULT_NAME);
bankAccount.setBalance(DEFAULT_BALANCE);
return bankAccount;
}
use of io.github.jhipster.sample.domain.BankAccount in project jhipster-sample-app-elasticsearch by jhipster.
the class BankAccountResource method createBankAccount.
/**
* POST /bank-accounts : Create a new bankAccount.
*
* @param bankAccount the bankAccount to create
* @return the ResponseEntity with status 201 (Created) and with body the new bankAccount, or with status 400 (Bad Request) if the bankAccount has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/bank-accounts")
@Timed
public ResponseEntity<BankAccount> createBankAccount(@Valid @RequestBody BankAccount bankAccount) throws URISyntaxException {
log.debug("REST request to save BankAccount : {}", bankAccount);
if (bankAccount.getId() != null) {
throw new BadRequestAlertException("A new bankAccount cannot already have an ID", ENTITY_NAME, "idexists");
}
BankAccount result = bankAccountRepository.save(bankAccount);
bankAccountSearchRepository.save(result);
return ResponseEntity.created(new URI("/api/bank-accounts/" + result.getId())).headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString())).body(result);
}
use of io.github.jhipster.sample.domain.BankAccount in project jhipster-sample-app-dto by jhipster.
the class BankAccountResourceIntTest method createEntity.
/**
* Create an entity for this test.
*
* This is a static method, as tests for other entities might also need it,
* if they test an entity which requires the current entity.
*/
public static BankAccount createEntity(EntityManager em) {
BankAccount bankAccount = new BankAccount();
bankAccount.setName(DEFAULT_NAME);
bankAccount.setBalance(DEFAULT_BALANCE);
return bankAccount;
}
Aggregations