I have the task of creating implementations for a large number of metric data structures (namely quadtree and kd tree ). I have about four of these implementations, but the way I am currently testing is, in my absence of a better word, good.
I need a clean way to check the insertion and deletion of data from these tree / trie structures so that I can test the internal structures of the nodes (checking parents, children, ordering, etc.). These implementations follow separate proofs of correctness and runtime analysis, so I need to make sure that not only the node is inserted correctly (which means you can retrieve it from the tree later), but also in a very “correct” position in the tree.
"Unit testing" seems like the wrong way around this, however, since the goal, if I'm not mistaken, is to check the structure or frontend of the API. I saw many questions related to unit testing that ask the question: “How to access the private field in unit test” or “how to check non-returning public methods return values”, and the answer is usually “not 't - and I agree this answer.
And so I do not leave those who want to help with blurry strokes, the interface that implements my trees is the following (based on the interface map of the java collection):
public interface SpatialMap<K, V> extends Iterable<SpatialMap.Entry<K, V>> {
This makes it difficult to test only using public methods, since I need certain data (child / parent pointers) that are not accessible from the public interface. In addition, in trie structures (PR Quadtree, PRKDTree, MX options, etc.) there are nodes that are separate from the data, so creating an open method that returns “node” will also abstract too far to get the right ones data.
What type of testing method (or technique that I can use with JUnit, and don't feel like I'm destroying beautiful cognitive boundaries) I'm looking for?