Search in sources :

Example 1 with SeriesStats

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

the class SeriesStatsResourceIntTest method updateSeriesStats.

@Test
@Transactional
public void updateSeriesStats() throws Exception {
    // Initialize the database
    seriesStatsRepository.saveAndFlush(seriesStats);
    int databaseSizeBeforeUpdate = seriesStatsRepository.findAll().size();
    // Update the seriesStats
    SeriesStats updatedSeriesStats = seriesStatsRepository.findOne(seriesStats.getId());
    updatedSeriesStats.status(UPDATED_STATUS).date(UPDATED_DATE);
    restSeriesStatsMockMvc.perform(put("/api/series-stats").contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(updatedSeriesStats))).andExpect(status().isOk());
    // Validate the SeriesStats in the database
    List<SeriesStats> seriesStatsList = seriesStatsRepository.findAll();
    assertThat(seriesStatsList).hasSize(databaseSizeBeforeUpdate);
    SeriesStats testSeriesStats = seriesStatsList.get(seriesStatsList.size() - 1);
    assertThat(testSeriesStats.getStatus()).isEqualTo(UPDATED_STATUS);
    assertThat(testSeriesStats.getDate()).isEqualTo(UPDATED_DATE);
}
Also used : SeriesStats(com.furyviewer.domain.SeriesStats) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with SeriesStats

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

the class SeriesStatsResourceIntTest method createSeriesStats.

@Test
@Transactional
public void createSeriesStats() throws Exception {
    int databaseSizeBeforeCreate = seriesStatsRepository.findAll().size();
    // Create the SeriesStats
    restSeriesStatsMockMvc.perform(post("/api/series-stats").contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(seriesStats))).andExpect(status().isCreated());
    // Validate the SeriesStats in the database
    List<SeriesStats> seriesStatsList = seriesStatsRepository.findAll();
    assertThat(seriesStatsList).hasSize(databaseSizeBeforeCreate + 1);
    SeriesStats testSeriesStats = seriesStatsList.get(seriesStatsList.size() - 1);
    assertThat(testSeriesStats.getStatus()).isEqualTo(DEFAULT_STATUS);
    assertThat(testSeriesStats.getDate()).isEqualTo(DEFAULT_DATE);
}
Also used : SeriesStats(com.furyviewer.domain.SeriesStats) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Transactional(org.springframework.transaction.annotation.Transactional)

Example 3 with SeriesStats

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

the class SeriesStatsResource method updateSeriesStats.

/**
 * PUT  /series-stats : Updates an existing seriesStats.
 *
 * @param seriesStats the seriesStats to update
 * @return the ResponseEntity with status 200 (OK) and with body the updated seriesStats,
 * or with status 400 (Bad Request) if the seriesStats is not valid,
 * or with status 500 (Internal Server Error) if the seriesStats couldn't be updated
 * @throws URISyntaxException if the Location URI syntax is incorrect
 */
@PutMapping("/series-stats")
@Timed
public ResponseEntity<SeriesStats> updateSeriesStats(@RequestBody SeriesStats seriesStats) throws URISyntaxException {
    log.debug("REST request to update SeriesStats : {}", seriesStats);
    if (seriesStats.getId() == null) {
        return createSeriesStats(seriesStats);
    }
    SeriesStats result = seriesStatsRepository.save(seriesStats);
    return ResponseEntity.ok().headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, seriesStats.getId().toString())).body(result);
}
Also used : SeriesStats(com.furyviewer.domain.SeriesStats) Timed(com.codahale.metrics.annotation.Timed)

Example 4 with SeriesStats

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

the class SeriesStatsResourceIntTest method equalsVerifier.

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

Example 5 with SeriesStats

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

the class SeriesStatsResource method createSeriesStats.

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

Aggregations

SeriesStats (com.furyviewer.domain.SeriesStats)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