Search in sources :

Example 1 with RateSeries

use of com.furyviewer.domain.RateSeries in project FuryViewer by TheDoctor-95.

the class RateSeriesResourceIntTest method updateRateSeries.

@Test
@Transactional
public void updateRateSeries() throws Exception {
    // Initialize the database
    rateSeriesRepository.saveAndFlush(rateSeries);
    int databaseSizeBeforeUpdate = rateSeriesRepository.findAll().size();
    // Update the rateSeries
    RateSeries updatedRateSeries = rateSeriesRepository.findOne(rateSeries.getId());
    updatedRateSeries.rate(UPDATED_RATE).date(UPDATED_DATE);
    restRateSeriesMockMvc.perform(put("/api/rate-series").contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(updatedRateSeries))).andExpect(status().isOk());
    // Validate the RateSeries in the database
    List<RateSeries> rateSeriesList = rateSeriesRepository.findAll();
    assertThat(rateSeriesList).hasSize(databaseSizeBeforeUpdate);
    RateSeries testRateSeries = rateSeriesList.get(rateSeriesList.size() - 1);
    assertThat(testRateSeries.getRate()).isEqualTo(UPDATED_RATE);
    assertThat(testRateSeries.getDate()).isEqualTo(UPDATED_DATE);
}
Also used : RateSeries(com.furyviewer.domain.RateSeries) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with RateSeries

use of com.furyviewer.domain.RateSeries in project FuryViewer by TheDoctor-95.

the class RateSeriesResourceIntTest method createRateSeries.

@Test
@Transactional
public void createRateSeries() throws Exception {
    int databaseSizeBeforeCreate = rateSeriesRepository.findAll().size();
    // Create the RateSeries
    restRateSeriesMockMvc.perform(post("/api/rate-series").contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(rateSeries))).andExpect(status().isCreated());
    // Validate the RateSeries in the database
    List<RateSeries> rateSeriesList = rateSeriesRepository.findAll();
    assertThat(rateSeriesList).hasSize(databaseSizeBeforeCreate + 1);
    RateSeries testRateSeries = rateSeriesList.get(rateSeriesList.size() - 1);
    assertThat(testRateSeries.getRate()).isEqualTo(DEFAULT_RATE);
    assertThat(testRateSeries.getDate()).isEqualTo(DEFAULT_DATE);
}
Also used : RateSeries(com.furyviewer.domain.RateSeries) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Transactional(org.springframework.transaction.annotation.Transactional)

Example 3 with RateSeries

use of com.furyviewer.domain.RateSeries in project FuryViewer by TheDoctor-95.

the class RateSeriesResource method getRateSeries.

/**
 * GET  /rate-series/:id : get the "id" rateSeries.
 *
 * @param id the id of the rateSeries to retrieve
 * @return the ResponseEntity with status 200 (OK) and with body the rateSeries, or with status 404 (Not Found)
 */
@GetMapping("/rate-series/{id}")
@Timed
public ResponseEntity<RateSeries> getRateSeries(@PathVariable Long id) {
    log.debug("REST request to get RateSeries : {}", id);
    RateSeries rateSeries = rateSeriesRepository.findOne(id);
    return ResponseUtil.wrapOrNotFound(Optional.ofNullable(rateSeries));
}
Also used : RateSeries(com.furyviewer.domain.RateSeries) Timed(com.codahale.metrics.annotation.Timed)

Example 4 with RateSeries

use of com.furyviewer.domain.RateSeries in project FuryViewer by TheDoctor-95.

the class RateSeriesResource method createRateSeries.

/**
 * POST  /rate-series : Create a new rateSeries.
 *
 * @param rateSeries the rateSeries to create
 * @return the ResponseEntity with status 201 (Created) and with body the new rateSeries, or with status 400 (Bad Request) if the rateSeries has already an ID
 * @throws URISyntaxException if the Location URI syntax is incorrect
 */
@PostMapping("/rate-series")
@Timed
public ResponseEntity<RateSeries> createRateSeries(@RequestBody RateSeries rateSeries) throws URISyntaxException {
    log.debug("REST request to save RateSeries : {}", rateSeries);
    if (rateSeries.getId() != null) {
        throw new BadRequestAlertException("A new rateSeries cannot already have an ID", ENTITY_NAME, "idexists");
    }
    RateSeries result = rateSeriesRepository.save(rateSeries);
    return ResponseEntity.created(new URI("/api/rate-series/" + result.getId())).headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString())).body(result);
}
Also used : BadRequestAlertException(com.furyviewer.web.rest.errors.BadRequestAlertException) URI(java.net.URI) RateSeries(com.furyviewer.domain.RateSeries) Timed(com.codahale.metrics.annotation.Timed)

Example 5 with RateSeries

use of com.furyviewer.domain.RateSeries in project FuryViewer by TheDoctor-95.

the class RateSeriesResourceIntTest method equalsVerifier.

@Test
@Transactional
public void equalsVerifier() throws Exception {
    TestUtil.equalsVerifier(RateSeries.class);
    RateSeries rateSeries1 = new RateSeries();
    rateSeries1.setId(1L);
    RateSeries rateSeries2 = new RateSeries();
    rateSeries2.setId(rateSeries1.getId());
    assertThat(rateSeries1).isEqualTo(rateSeries2);
    rateSeries2.setId(2L);
    assertThat(rateSeries1).isNotEqualTo(rateSeries2);
    rateSeries1.setId(null);
    assertThat(rateSeries1).isNotEqualTo(rateSeries2);
}
Also used : RateSeries(com.furyviewer.domain.RateSeries) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

RateSeries (com.furyviewer.domain.RateSeries)6 Timed (com.codahale.metrics.annotation.Timed)3 Test (org.junit.Test)3 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)3 Transactional (org.springframework.transaction.annotation.Transactional)3 BadRequestAlertException (com.furyviewer.web.rest.errors.BadRequestAlertException)1 URI (java.net.URI)1