Search in sources :

Example 1 with ReviewSeries

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

the class ReviewSeriesResourceIntTest method createReviewSeries.

@Test
@Transactional
public void createReviewSeries() throws Exception {
    int databaseSizeBeforeCreate = reviewSeriesRepository.findAll().size();
    // Create the ReviewSeries
    restReviewSeriesMockMvc.perform(post("/api/review-series").contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(reviewSeries))).andExpect(status().isCreated());
    // Validate the ReviewSeries in the database
    List<ReviewSeries> reviewSeriesList = reviewSeriesRepository.findAll();
    assertThat(reviewSeriesList).hasSize(databaseSizeBeforeCreate + 1);
    ReviewSeries testReviewSeries = reviewSeriesList.get(reviewSeriesList.size() - 1);
    assertThat(testReviewSeries.getDate()).isEqualTo(DEFAULT_DATE);
    assertThat(testReviewSeries.getTitle()).isEqualTo(DEFAULT_TITLE);
    assertThat(testReviewSeries.getReview()).isEqualTo(DEFAULT_REVIEW);
}
Also used : ReviewSeries(com.furyviewer.domain.ReviewSeries) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with ReviewSeries

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

the class ReviewSeriesResourceIntTest method updateReviewSeries.

@Test
@Transactional
public void updateReviewSeries() throws Exception {
    // Initialize the database
    reviewSeriesRepository.saveAndFlush(reviewSeries);
    int databaseSizeBeforeUpdate = reviewSeriesRepository.findAll().size();
    // Update the reviewSeries
    ReviewSeries updatedReviewSeries = reviewSeriesRepository.findOne(reviewSeries.getId());
    updatedReviewSeries.date(UPDATED_DATE).title(UPDATED_TITLE).review(UPDATED_REVIEW);
    restReviewSeriesMockMvc.perform(put("/api/review-series").contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(updatedReviewSeries))).andExpect(status().isOk());
    // Validate the ReviewSeries in the database
    List<ReviewSeries> reviewSeriesList = reviewSeriesRepository.findAll();
    assertThat(reviewSeriesList).hasSize(databaseSizeBeforeUpdate);
    ReviewSeries testReviewSeries = reviewSeriesList.get(reviewSeriesList.size() - 1);
    assertThat(testReviewSeries.getDate()).isEqualTo(UPDATED_DATE);
    assertThat(testReviewSeries.getTitle()).isEqualTo(UPDATED_TITLE);
    assertThat(testReviewSeries.getReview()).isEqualTo(UPDATED_REVIEW);
}
Also used : ReviewSeries(com.furyviewer.domain.ReviewSeries) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Transactional(org.springframework.transaction.annotation.Transactional)

Example 3 with ReviewSeries

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

the class ReviewSeriesResourceIntTest method equalsVerifier.

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

Example 4 with ReviewSeries

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

the class ReviewSeriesResource method createReviewSeries.

/**
 * POST  /review-series : Create a new reviewSeries.
 *
 * @param reviewSeries the reviewSeries to create
 * @return the ResponseEntity with status 201 (Created) and with body the new reviewSeries, or with status 400 (Bad Request) if the reviewSeries has already an ID
 * @throws URISyntaxException if the Location URI syntax is incorrect
 */
@PostMapping("/review-series")
@Timed
public ResponseEntity<ReviewSeries> createReviewSeries(@RequestBody ReviewSeries reviewSeries) throws URISyntaxException {
    log.debug("REST request to save ReviewSeries : {}", reviewSeries);
    if (reviewSeries.getId() != null) {
        throw new BadRequestAlertException("A new reviewSeries cannot already have an ID", ENTITY_NAME, "idexists");
    }
    ReviewSeries result = reviewSeriesRepository.save(reviewSeries);
    return ResponseEntity.created(new URI("/api/review-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) ReviewSeries(com.furyviewer.domain.ReviewSeries) Timed(com.codahale.metrics.annotation.Timed)

Example 5 with ReviewSeries

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

the class ReviewSeriesResource method updateReviewSeries.

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

Aggregations

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