List of usage examples for org.apache.commons.math3.fraction BigFraction ONE_THIRD
BigFraction ONE_THIRD
To view the source code for org.apache.commons.math3.fraction BigFraction ONE_THIRD.
Click Source Link
From source file:info.gehrels.voting.singleTransferableVote.VoteStateTest.java
@Test public void returnsNewVoteStateWithSameValuesButUpdatedVoteWeight() { Ballot<Candidate> ballot = TestUtils.createBallot("AB", ELECTION); VoteState<Candidate> voteState = VoteState.forBallotAndElection(ballot, ELECTION).get(); VoteState<Candidate> newVoteState = voteState.withVoteWeight(BigFraction.ONE_THIRD); assertThat(newVoteState, is(not(sameInstance(voteState)))); assertThat(newVoteState.getPreferredCandidate(), is(equalTo(voteState.getPreferredCandidate()))); assertThat(newVoteState.isInvalid(), is(false)); assertThat(newVoteState.isNoVote(), is(false)); assertThat(newVoteState.getVoteWeight(), is(not(equalTo(voteState.getVoteWeight())))); assertThat(newVoteState.getVoteWeight(), is(equalTo(BigFraction.ONE_THIRD))); }