use of com.furyviewer.domain.FavouriteSeries in project FuryViewer by TheDoctor-95.
the class FavouriteSeriesResourceIntTest method equalsVerifier.
@Test
@Transactional
public void equalsVerifier() throws Exception {
TestUtil.equalsVerifier(FavouriteSeries.class);
FavouriteSeries favouriteSeries1 = new FavouriteSeries();
favouriteSeries1.setId(1L);
FavouriteSeries favouriteSeries2 = new FavouriteSeries();
favouriteSeries2.setId(favouriteSeries1.getId());
assertThat(favouriteSeries1).isEqualTo(favouriteSeries2);
favouriteSeries2.setId(2L);
assertThat(favouriteSeries1).isNotEqualTo(favouriteSeries2);
favouriteSeries1.setId(null);
assertThat(favouriteSeries1).isNotEqualTo(favouriteSeries2);
}
use of com.furyviewer.domain.FavouriteSeries in project FuryViewer by TheDoctor-95.
the class FavouriteSeriesResource method getFavouriteSeries.
/**
* GET /favourite-series/:id : get the "id" favouriteSeries.
*
* @param id the id of the favouriteSeries to retrieve
* @return the ResponseEntity with status 200 (OK) and with body the favouriteSeries, or with status 404 (Not Found)
*/
@GetMapping("/favourite-series/{id}")
@Timed
public ResponseEntity<FavouriteSeries> getFavouriteSeries(@PathVariable Long id) {
log.debug("REST request to get FavouriteSeries : {}", id);
FavouriteSeries favouriteSeries = favouriteSeriesRepository.findOne(id);
return ResponseUtil.wrapOrNotFound(Optional.ofNullable(favouriteSeries));
}
use of com.furyviewer.domain.FavouriteSeries in project FuryViewer by TheDoctor-95.
the class FavouriteSeriesResource method updateFavouriteSeries.
/**
* PUT /favourite-series : Updates an existing favouriteSeries.
*
* @param favouriteSeries the favouriteSeries to update
* @return the ResponseEntity with status 200 (OK) and with body the updated favouriteSeries,
* or with status 400 (Bad Request) if the favouriteSeries is not valid,
* or with status 500 (Internal Server Error) if the favouriteSeries couldn't be updated
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PutMapping("/favourite-series")
@Timed
public ResponseEntity<FavouriteSeries> updateFavouriteSeries(@RequestBody FavouriteSeries favouriteSeries) throws URISyntaxException {
log.debug("REST request to update FavouriteSeries : {}", favouriteSeries);
if (favouriteSeries.getId() == null) {
return createFavouriteSeries(favouriteSeries);
}
FavouriteSeries result = favouriteSeriesRepository.save(favouriteSeries);
return ResponseEntity.ok().headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, favouriteSeries.getId().toString())).body(result);
}
use of com.furyviewer.domain.FavouriteSeries in project FuryViewer by TheDoctor-95.
the class FavouriteSeriesResourceIntTest method createFavouriteSeries.
@Test
@Transactional
public void createFavouriteSeries() throws Exception {
int databaseSizeBeforeCreate = favouriteSeriesRepository.findAll().size();
// Create the FavouriteSeries
restFavouriteSeriesMockMvc.perform(post("/api/favourite-series").contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(favouriteSeries))).andExpect(status().isCreated());
// Validate the FavouriteSeries in the database
List<FavouriteSeries> favouriteSeriesList = favouriteSeriesRepository.findAll();
assertThat(favouriteSeriesList).hasSize(databaseSizeBeforeCreate + 1);
FavouriteSeries testFavouriteSeries = favouriteSeriesList.get(favouriteSeriesList.size() - 1);
assertThat(testFavouriteSeries.isLiked()).isEqualTo(DEFAULT_LIKED);
assertThat(testFavouriteSeries.getDate()).isEqualTo(DEFAULT_DATE);
}
use of com.furyviewer.domain.FavouriteSeries in project FuryViewer by TheDoctor-95.
the class FavouriteSeriesResourceIntTest method updateFavouriteSeries.
@Test
@Transactional
public void updateFavouriteSeries() throws Exception {
// Initialize the database
favouriteSeriesRepository.saveAndFlush(favouriteSeries);
int databaseSizeBeforeUpdate = favouriteSeriesRepository.findAll().size();
// Update the favouriteSeries
FavouriteSeries updatedFavouriteSeries = favouriteSeriesRepository.findOne(favouriteSeries.getId());
updatedFavouriteSeries.liked(UPDATED_LIKED).date(UPDATED_DATE);
restFavouriteSeriesMockMvc.perform(put("/api/favourite-series").contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(updatedFavouriteSeries))).andExpect(status().isOk());
// Validate the FavouriteSeries in the database
List<FavouriteSeries> favouriteSeriesList = favouriteSeriesRepository.findAll();
assertThat(favouriteSeriesList).hasSize(databaseSizeBeforeUpdate);
FavouriteSeries testFavouriteSeries = favouriteSeriesList.get(favouriteSeriesList.size() - 1);
assertThat(testFavouriteSeries.isLiked()).isEqualTo(UPDATED_LIKED);
assertThat(testFavouriteSeries.getDate()).isEqualTo(UPDATED_DATE);
}
Aggregations