use of io.github.jhipster.sample.domain.BankAccount in project jhipster-sample-app-hazelcast 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-mongodb by jhipster.
the class BankAccountResourceIntTest method createBankAccount.
@Test
public void createBankAccount() throws Exception {
int databaseSizeBeforeCreate = bankAccountRepository.findAll().size();
// Create the BankAccount
restBankAccountMockMvc.perform(post("/api/bank-accounts").contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(bankAccount))).andExpect(status().isCreated());
// Validate the BankAccount in the database
List<BankAccount> bankAccountList = bankAccountRepository.findAll();
assertThat(bankAccountList).hasSize(databaseSizeBeforeCreate + 1);
BankAccount testBankAccount = bankAccountList.get(bankAccountList.size() - 1);
assertThat(testBankAccount.getName()).isEqualTo(DEFAULT_NAME);
assertThat(testBankAccount.getBalance()).isEqualTo(DEFAULT_BALANCE);
}
use of io.github.jhipster.sample.domain.BankAccount in project jhipster-sample-app-mongodb 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() {
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-mongodb by jhipster.
the class BankAccountResourceIntTest method equalsVerifier.
@Test
public void equalsVerifier() throws Exception {
TestUtil.equalsVerifier(BankAccount.class);
BankAccount bankAccount1 = new BankAccount();
bankAccount1.setId("id1");
BankAccount bankAccount2 = new BankAccount();
bankAccount2.setId(bankAccount1.getId());
assertThat(bankAccount1).isEqualTo(bankAccount2);
bankAccount2.setId("id2");
assertThat(bankAccount1).isNotEqualTo(bankAccount2);
bankAccount1.setId(null);
assertThat(bankAccount1).isNotEqualTo(bankAccount2);
}
use of io.github.jhipster.sample.domain.BankAccount in project jhipster-sample-app-hazelcast 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);
return ResponseEntity.created(new URI("/api/bank-accounts/" + result.getId())).headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString())).body(result);
}
Aggregations