Search in sources :

Example 16 with BankAccount

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;
}
Also used : BankAccount(io.github.jhipster.sample.domain.BankAccount)

Example 17 with 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);
}
Also used : BankAccount(io.github.jhipster.sample.domain.BankAccount) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 18 with BankAccount

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;
}
Also used : BankAccount(io.github.jhipster.sample.domain.BankAccount)

Example 19 with 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);
}
Also used : BankAccount(io.github.jhipster.sample.domain.BankAccount) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 20 with BankAccount

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);
}
Also used : BadRequestAlertException(io.github.jhipster.sample.web.rest.errors.BadRequestAlertException) BankAccount(io.github.jhipster.sample.domain.BankAccount) URI(java.net.URI) Timed(com.codahale.metrics.annotation.Timed)

Aggregations

BankAccount (io.github.jhipster.sample.domain.BankAccount)28 Test (org.junit.Test)16 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)16 Transactional (org.springframework.transaction.annotation.Transactional)13 Timed (com.codahale.metrics.annotation.Timed)8 BankAccountDTO (io.github.jhipster.sample.service.dto.BankAccountDTO)8 BadRequestAlertException (io.github.jhipster.sample.web.rest.errors.BadRequestAlertException)4 URI (java.net.URI)4