• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java: Hash Table with Open Addressing - Figuring out what to write to test this code properly.  RSS feed

 
Shakur Burton
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have begun work on a hash table with open addressing. So, far, this code i the progress I have made:

The Entry code for my hash values:



The Deleted Entry code for my hash table (holds onto deleted values to put back in the table at some point later, if need be.):



The Hash Table code itself, finally, is right here...


I know that in order to test this code, I would create a main method in the HashMap class. I, however, am having some issues with picking the right variables to test out here, unfortunately.
Any suggestions are welcome here. Thank You for your time.
 
Gamini Sirisena
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about junit?

You could either write test methods combining put, remove etc. with a get
OR you could use Mockito WhiteBox class to get at your HashEntry[] table; to test the behaviour of a method
 
Shakur Burton
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gamini Sirisena wrote:How about junit?

You could either write test methods combining put, remove etc. with a get
OR you could use Mockito WhiteBox class to get at your HashEntry[] table; to test the behaviour of a method


I don't about JUnit or Mockito, unfortunately... But yeah, testing the methods provided souns about right. I'll try it ASAP and get back, should I find anything wrong (I am working with Java Eclipse, BTW...).

Thanks for the advice.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!