Using GroovyTestCase, I need to test if a LinkedList's last node is what I intend it to be. I don't want to give this class a public accessor.
First some potentially useful information about my classes:
- Node is a private subclass of LinkedList
- LastNode is private
- LinkedList is public and a .java file
- LinkedListTest is a .groovy file
Here is an example:
class LinkedListTest extends GroovyTestCase
{
// == -- TEST ADD AT LAST ELEMENT -- == //
void testAdd_1Arg()
{
add1_entries_currently_in_the_list_are_unaffected ( )
add1_lists_size_is_increased_by_1 ( )
add1_adds_to_last_entry( )
}
void add1_adds_to_last_entry()
{
int size = 5;
LinkedList<Object> linkedList = get_n_element_integerType_LinkedList ( size );
linkedList.add ( -1 )
// check if Instance variable LastNode.data == size+10
} }
I marked the line where my question is specific to as // check if Instance variable LastNode.data == size+10
.