Search in sources :

Example 1 with HatredMovie

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

the class HatredMovieResourceIntTest method updateHatredMovie.

@Test
@Transactional
public void updateHatredMovie() throws Exception {
    // Initialize the database
    hatredMovieRepository.saveAndFlush(hatredMovie);
    int databaseSizeBeforeUpdate = hatredMovieRepository.findAll().size();
    // Update the hatredMovie
    HatredMovie updatedHatredMovie = hatredMovieRepository.findOne(hatredMovie.getId());
    updatedHatredMovie.hated(UPDATED_HATED).date(UPDATED_DATE);
    restHatredMovieMockMvc.perform(put("/api/hatred-movies").contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(updatedHatredMovie))).andExpect(status().isOk());
    // Validate the HatredMovie in the database
    List<HatredMovie> hatredMovieList = hatredMovieRepository.findAll();
    assertThat(hatredMovieList).hasSize(databaseSizeBeforeUpdate);
    HatredMovie testHatredMovie = hatredMovieList.get(hatredMovieList.size() - 1);
    assertThat(testHatredMovie.isHated()).isEqualTo(UPDATED_HATED);
    assertThat(testHatredMovie.getDate()).isEqualTo(UPDATED_DATE);
}
Also used : HatredMovie(com.furyviewer.domain.HatredMovie) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with HatredMovie

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

the class HatredMovieResourceIntTest method createHatredMovie.

@Test
@Transactional
public void createHatredMovie() throws Exception {
    int databaseSizeBeforeCreate = hatredMovieRepository.findAll().size();
    // Create the HatredMovie
    restHatredMovieMockMvc.perform(post("/api/hatred-movies").contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(hatredMovie))).andExpect(status().isCreated());
    // Validate the HatredMovie in the database
    List<HatredMovie> hatredMovieList = hatredMovieRepository.findAll();
    assertThat(hatredMovieList).hasSize(databaseSizeBeforeCreate + 1);
    HatredMovie testHatredMovie = hatredMovieList.get(hatredMovieList.size() - 1);
    assertThat(testHatredMovie.isHated()).isEqualTo(DEFAULT_HATED);
    assertThat(testHatredMovie.getDate()).isEqualTo(DEFAULT_DATE);
}
Also used : HatredMovie(com.furyviewer.domain.HatredMovie) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Transactional(org.springframework.transaction.annotation.Transactional)

Example 3 with HatredMovie

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

the class HatredMovieResource method updateHatredMovie.

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

Example 4 with HatredMovie

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

the class HatredMovieResourceIntTest method equalsVerifier.

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

Example 5 with HatredMovie

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

the class HatredMovieResource method getHatredMovie.

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

Aggregations

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