use of org.broadinstitute.consent.http.models.Vote in project consent by DataBiosphere.
the class VoteServiceTest method testCreateDataOwnersReviewVotes.
@Test
public void testCreateDataOwnersReviewVotes() {
Election e = new Election();
e.setElectionId(1);
e.setDataSetId(1);
when(dataSetAssociationDAO.getDataOwnersOfDataSet(anyInt())).thenReturn(Collections.singletonList(1));
Vote v = new Vote();
v.setVoteId(1);
when(voteDAO.insertVote(anyInt(), anyInt(), any())).thenReturn(v.getVoteId());
when(voteDAO.findVoteById(anyInt())).thenReturn(v);
when(voteDAO.findVotesByElectionIdAndType(anyInt(), anyString())).thenReturn(Collections.singletonList(v));
initService();
List<Vote> votes = service.createDataOwnersReviewVotes(e);
assertFalse(votes.isEmpty());
}
use of org.broadinstitute.consent.http.models.Vote in project consent by DataBiosphere.
the class VoteServiceTest method testChairCreateVotesRP.
@Test
public void testChairCreateVotesRP() {
setUpUserAndElectionVotes(UserRoles.CHAIRPERSON);
initService();
List<Vote> votes = service.createVotes(new Election(), ElectionType.RP, false);
assertFalse(votes.isEmpty());
// Should create 2 votes:
// Chairperson as a chair
// Chairperson as a dac member
assertEquals(2, votes.size());
}
use of org.broadinstitute.consent.http.models.Vote in project consent by DataBiosphere.
the class VoteServiceTest method testUpdateVote_ByReferenceId.
@Test
public void testUpdateVote_ByReferenceId() {
Vote v = setUpTestVote(false, false);
when(voteDAO.checkVoteById("test", v.getVoteId())).thenReturn(v.getVoteId());
when(electionDAO.getOpenElectionIdByReferenceId("test")).thenReturn(1);
initService();
Vote vote = service.updateVote(v, v.getVoteId(), "test");
assertNotNull(vote);
}
use of org.broadinstitute.consent.http.models.Vote in project consent by DataBiosphere.
the class VoteServiceTest method testMemberCreateVotesDataAccessManualReview.
@Test
public void testMemberCreateVotesDataAccessManualReview() {
setUpUserAndElectionVotes(UserRoles.MEMBER);
initService();
List<Vote> votes = service.createVotes(new Election(), ElectionType.DATA_ACCESS, false);
assertFalse(votes.isEmpty());
// Should create 1 member vote
assertEquals(1, votes.size());
}
use of org.broadinstitute.consent.http.models.Vote in project consent by DataBiosphere.
the class VoteServiceTest method testAdvanceVotes.
@Test
public void testAdvanceVotes() {
Vote v = setUpTestVote(false, false);
initService();
try {
service.advanceVotes(Collections.singletonList(v), true, "New Rationale");
} catch (Exception e) {
Assert.fail("Should not error: " + e.getMessage());
}
}
Aggregations