Search in sources :

Example 1 with ChapterSeen

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

the class ChapterSeenResourceIntTest method equalsVerifier.

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

Example 2 with ChapterSeen

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

the class ChapterSeenResource method getChapterSeen.

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

Example 3 with ChapterSeen

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

the class ChapterSeenResourceIntTest method updateChapterSeen.

@Test
@Transactional
public void updateChapterSeen() throws Exception {
    // Initialize the database
    chapterSeenRepository.saveAndFlush(chapterSeen);
    int databaseSizeBeforeUpdate = chapterSeenRepository.findAll().size();
    // Update the chapterSeen
    ChapterSeen updatedChapterSeen = chapterSeenRepository.findOne(chapterSeen.getId());
    updatedChapterSeen.seen(UPDATED_SEEN).date(UPDATED_DATE);
    restChapterSeenMockMvc.perform(put("/api/chapter-seens").contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(updatedChapterSeen))).andExpect(status().isOk());
    // Validate the ChapterSeen in the database
    List<ChapterSeen> chapterSeenList = chapterSeenRepository.findAll();
    assertThat(chapterSeenList).hasSize(databaseSizeBeforeUpdate);
    ChapterSeen testChapterSeen = chapterSeenList.get(chapterSeenList.size() - 1);
    assertThat(testChapterSeen.isSeen()).isEqualTo(UPDATED_SEEN);
    assertThat(testChapterSeen.getDate()).isEqualTo(UPDATED_DATE);
}
Also used : ChapterSeen(com.furyviewer.domain.ChapterSeen) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Transactional(org.springframework.transaction.annotation.Transactional)

Example 4 with ChapterSeen

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

the class ChapterSeenResourceIntTest method createChapterSeen.

@Test
@Transactional
public void createChapterSeen() throws Exception {
    int databaseSizeBeforeCreate = chapterSeenRepository.findAll().size();
    // Create the ChapterSeen
    restChapterSeenMockMvc.perform(post("/api/chapter-seens").contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(chapterSeen))).andExpect(status().isCreated());
    // Validate the ChapterSeen in the database
    List<ChapterSeen> chapterSeenList = chapterSeenRepository.findAll();
    assertThat(chapterSeenList).hasSize(databaseSizeBeforeCreate + 1);
    ChapterSeen testChapterSeen = chapterSeenList.get(chapterSeenList.size() - 1);
    assertThat(testChapterSeen.isSeen()).isEqualTo(DEFAULT_SEEN);
    assertThat(testChapterSeen.getDate()).isEqualTo(DEFAULT_DATE);
}
Also used : ChapterSeen(com.furyviewer.domain.ChapterSeen) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Transactional(org.springframework.transaction.annotation.Transactional)

Example 5 with ChapterSeen

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

the class ChapterSeenResource method createChapterSeen.

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

Aggregations

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