use of com.icthh.xm.ms.entity.domain.Vote in project xm-ms-entity by xm-online.
the class VoteResourceIntTest method updateVote.
@Test
@Transactional
public void updateVote() throws Exception {
// Initialize the database
voteRepository.saveAndFlush(vote);
voteSearchRepository.save(vote);
int databaseSizeBeforeUpdate = voteRepository.findAll().size();
// Update the vote
Vote updatedVote = voteRepository.findOne(vote.getId());
updatedVote.userKey(UPDATED_USER_KEY).value(UPDATED_VALUE).message(UPDATED_MESSAGE).entryDate(UPDATED_ENTRY_DATE);
restVoteMockMvc.perform(put("/api/votes").contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(updatedVote))).andExpect(status().isOk());
// Validate the Vote in the database
List<Vote> voteList = voteRepository.findAll();
assertThat(voteList).hasSize(databaseSizeBeforeUpdate);
Vote testVote = voteList.get(voteList.size() - 1);
assertThat(testVote.getUserKey()).isEqualTo(UPDATED_USER_KEY);
assertThat(testVote.getValue()).isEqualTo(UPDATED_VALUE);
assertThat(testVote.getMessage()).isEqualTo(UPDATED_MESSAGE);
assertThat(testVote.getEntryDate()).isEqualTo(UPDATED_ENTRY_DATE);
// Validate the Vote in Elasticsearch
Vote voteEs = voteSearchRepository.findOne(testVote.getId());
assertThat(voteEs).isEqualToComparingFieldByField(testVote);
}
use of com.icthh.xm.ms.entity.domain.Vote in project xm-ms-entity by xm-online.
the class VoteResourceExtendedIntTest method checkEntryDateIsNotRequired.
@Test
@Transactional
public void checkEntryDateIsNotRequired() throws Exception {
int databaseSizeBeforeTest = voteRepository.findAll().size();
// set the field null
vote.setEntryDate(null);
// Create the Vote.
restVoteMockMvc.perform(post("/api/votes").contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(vote))).andExpect(status().isCreated()).andExpect(jsonPath("$.entryDate").value(MOCKED_ENTRY_DATE.toString()));
List<Vote> voteList = voteRepository.findAll();
assertThat(voteList).hasSize(databaseSizeBeforeTest + 1);
Vote testVote = voteList.get(voteList.size() - 1);
assertThat(testVote.getEntryDate()).isEqualTo(MOCKED_ENTRY_DATE);
// Validate the Vote in Elasticsearch
Vote voteEs = voteSearchRepository.findOne(testVote.getId());
assertThat(voteEs).isEqualToComparingFieldByField(testVote);
}
use of com.icthh.xm.ms.entity.domain.Vote in project xm-ms-entity by xm-online.
the class VoteResourceIntTest method createEntity.
/**
* Create an entity for this test.
*
* This is a static method, as tests for other entities might also need it,
* if they test an entity which requires the current entity.
*/
public static Vote createEntity(EntityManager em) {
Vote vote = new Vote().userKey(DEFAULT_USER_KEY).value(DEFAULT_VALUE).message(DEFAULT_MESSAGE).entryDate(DEFAULT_ENTRY_DATE);
// Add required entity
XmEntity xmEntity = XmEntityResourceIntTest.createEntity(em);
em.persist(xmEntity);
em.flush();
vote.setXmEntity(xmEntity);
Rating rating = RatingResourceIntTest.createEntity(em);
em.persist(rating);
em.flush();
vote.setRating(rating);
return vote;
}
use of com.icthh.xm.ms.entity.domain.Vote in project xm-ms-entity by xm-online.
the class VoteResourceIntTest method equalsVerifier.
@Test
@Transactional
public void equalsVerifier() throws Exception {
TestUtil.equalsVerifier(Vote.class);
Vote vote1 = new Vote();
vote1.setId(1L);
Vote vote2 = new Vote();
vote2.setId(vote1.getId());
assertThat(vote1).isEqualTo(vote2);
vote2.setId(2L);
assertThat(vote1).isNotEqualTo(vote2);
vote1.setId(null);
assertThat(vote1).isNotEqualTo(vote2);
}
use of com.icthh.xm.ms.entity.domain.Vote in project xm-ms-entity by xm-online.
the class DeleteEntityTest method createXmEntity.
private XmEntity createXmEntity() {
XmEntity xmEntity = new XmEntity().key(randomUUID().toString()).typeKey("TEST_DELETE");
xmEntity.name("name").functionContexts(asSet(new FunctionContext().key("1").typeKey("A").xmEntity(xmEntity), new FunctionContext().key("2").typeKey("A").xmEntity(xmEntity), new FunctionContext().key("3").typeKey("A").xmEntity(xmEntity))).attachments(asSet(new Attachment().typeKey("A").name("1"), new Attachment().typeKey("A").name("2"), new Attachment().typeKey("A").name("3"))).calendars(asSet(new Calendar().typeKey("A").name("1").events(asSet(new Event().typeKey("A").title("1"), new Event().typeKey("A").title("2"))), new Calendar().typeKey("A").name("2").events(asSet(new Event().typeKey("A").title("3"), new Event().typeKey("A").title("4"))))).locations(asSet(new Location().typeKey("A").name("1"), new Location().typeKey("A").name("2"))).ratings(asSet(new Rating().typeKey("A").votes(asSet(new Vote().message("1").value(1.1).userKey("1"), new Vote().message("2").value(2.1).userKey("2"))))).tags(asSet(new Tag().typeKey("A").name("1"), new Tag().typeKey("A").name("2"))).comments(asSet(new Comment().message("1").userKey("1"), new Comment().message("2").userKey("1")));
return xmEntity;
}
Aggregations