Tests for the Data class/locking mechanism (OCMJD forum at Coderanch) (original) (raw)
Howdy y'all, what y'all doin'?!
Guys, here are the tests I created to test the main functionalities of my implementation of the Data class and the locking mechanism. It also contains a header I created for each class. Some customization of this code will be necessary, according to the implementation of each developer. For instance, my project was the URLyBird 1.3.1, and my lock method does not return any value, and there are some cases where the lock method returns a long value, so this would be a case of customization. Throughout the code, you guys will notice that I used a class called Room and a class called RoomRetriever. The Room class is a representation of a database record, and the RoomRetriever class has 2 methods: one to transform a String array to a Room object, and a Room object to a String array.
This test is supposed to be executed in less than 1 second, so if it doesn't finish in less than 1 second, then the deadlock occurred. It is a very simple and objective test, nothing fancy, but it really helped me getting 80/80 for my locking mechanism and 40/40 for my data storage implementation.
I really hope this helps everyone still working on the assignment!!!