Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: For loop Driver Testing

  1. #1
    Junior Member
    Join Date
    Nov 2011
    Posts
    16
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default For loop Driver Testing

    I am testing a nextDate() and prevDate() methods which increment a SimpleDate object and for testing purposes I am running it 400 times with a for loop. For both tests the for loop is the same but
    I can only get it to increment once then print that 400 times. I figure this is a simple fix but I just can't figure it out. Any help is appreciated, thank you.

    // Test nextDate
          SimpleDate dateTest = new SimpleDate(12 , 31 , 2008);
          for(int i = 0; i <400; i++) {
        	  System.out.println(dateTest.nextDate()); 
          }

    nextDate() just returns a SimpleDate object that is one day later and changed the month or year depending on the day.


  2. #2
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: For loop Driver Testing

    Where is the code for SimpleDate class? And also you are not storing the new Date value in the object so, how it would come to know the nextDate() for which Date? It only has already stored value and always keep getting the nextDate() according to that Date.

Similar Threads

  1. Testing for a Palindrome
    By ryan.sampson in forum Algorithms & Recursion
    Replies: 12
    Last Post: November 6th, 2011, 07:01 PM
  2. If Testing, testing for another if?
    By Rusticus in forum Loops & Control Statements
    Replies: 10
    Last Post: October 1st, 2011, 10:18 AM
  3. [SOLVED] Testing Java EE
    By serdar in forum What's Wrong With My Code?
    Replies: 1
    Last Post: August 16th, 2011, 04:39 AM
  4. Need Help on testing Code
    By indidude89 in forum Java Theory & Questions
    Replies: 2
    Last Post: May 9th, 2011, 12:53 PM
  5. SMS Encryption Testing
    By ants_dj07 in forum Java ME (Mobile Edition)
    Replies: 5
    Last Post: March 27th, 2011, 11:14 AM