Hi,
In order for the examiners to
test the data class they should be able to get an instance of it in a way that it documented, right? After reading the instructions carefully, I assume there's no need of a default constructor.
The issue I'm having is that I have a database class which has the data class as a variable (no setters or getters though, it's a kind of delegate) and it passes itself (during instantiation) to the data class as a parameter so that the data class knows how it should read/write data since the database class knows the schema etc.
There is a way to test the data class separately, but it requires to also create an instance of the database class (which has the schema, remember)and thus we will end up with two instances of the data class (one which the tester has an instance of and one which is in the database class).
If the examiners only test the methods through the data instance they get directly and not indirectly (delegation) through the database instance, I should be ok. However, if they test the two instances of the data class with different threads, I don't know how things will work. The data class uses an instance of RandomAccessFile to read/write the data file. Is this a bad design?
I don't want the database class to expose the data class via getters. Can anyone give me a hint on how I should continue? It seems to me that I'm running in circles.
Regards,
Mattew