Beispiel #1
0
 /** test for method vote(..) */
 public void testVote() {
   V1Poll p = testV1polls[1];
   p.m_hash = ByteArray.makeRandomBytes(20);
   try {
     p.castOurVote();
   } catch (IllegalStateException e) {
     // the socket isn't inited and should squack
   }
   p.m_pollstate = V1Poll.PS_COMPLETE;
 }
Beispiel #2
0
  /** test for method voteInPoll(..) */
  public void testVoteInPoll() {
    V1Poll p = testV1polls[1];
    p.m_tally.quorum = 10;
    p.m_tally.numAgree = 5;
    p.m_tally.numDisagree = 2;
    p.m_tally.wtAgree = 2000;
    p.m_tally.wtDisagree = 200;
    p.m_hash = ByteArray.makeRandomBytes(20);
    try {
      p.voteInPoll();
    } catch (IllegalStateException e) {
      // the socket isn't inited and should squack
    }

    p.m_tally.numAgree = 20;
    try {
      p.voteInPoll();
    } catch (NullPointerException npe) {
      // the socket isn't inited and should squack
    }
    p.m_pollstate = V1Poll.PS_COMPLETE;
  }