Ignore:
Timestamp:
Oct 26, 2010, 6:19:27 AM (14 years ago)
Author:
Rick van der Zwet
Message:

Some more usefull tests and debugging

File:
1 edited

Legend:

Unmodified
Added
Removed
  • liacs/TOOS/assignment1/src/Census.java

    r206 r209  
    1313  static Logger logger = Logger.getLogger(Census.class);
    1414  public static void main(String[] args) {
    15     BasicConfigurator.configure();
    16    
    17     Census census = new Census();
    18 
    19     HashSet<Voter> voters = new HashSet<Voter>();
    20     voters.add(new Voter(true));
    21     voters.add(new Voter(true));
    22     Voter duplicate  = new Voter(true);
    23     voters.add(duplicate);
    24     voters.add(duplicate);
    25     //voters.add(new Voter());
    26    
    27     logger.info(census.census(voters));
    2815  }
    2916  /**
     
    3522   * @return boolean with conjuction of voters or null on error.
    3623   */
    37   public Boolean census(HashSet<Voter> voters) {
     24  public static Boolean census(HashSet<Voter> voters) {
     25
    3826    /* Nobody likes voting on Tuesday don't they? */
    3927    Calendar rightNow = Calendar.getInstance();
    40     if (rightNow.get(Calendar.DAY_OF_WEEK) == Calendar.TUESDAY) {
     28    if (rightNow.get(Calendar.DAY_OF_WEEK) == Calendar.WEDNESDAY) {
    4129      return false;
    4230    }
     
    4735      /* Some vote is not set correctly or of wrong return value */
    4836      if (v.getVote() == null || (!(v.getVote() instanceof Boolean))) {
    49         return false;
     37        logger.debug("Invalid type");
     38        return null;
    5039      }
    5140
Note: See TracChangeset for help on using the changeset viewer.