```/*************************************************************************
* Author: Isai Damier
* Title: BST to Circular Doubly Linked List (Recursive)
* Project: geekviewpoint
* Package: algorithms
*
* Time Complexity of Solution:
*   Best = Average = Worst = O(n).
*
* Description: Convert a BST into a circular doubly LinkedList.
*
* Technical Details: This is a recursive method for converting a BST into a
*   cyclic doubly LinkedList. This is not the only recursive method around.
*   This method however inculcates the truth that Java does not pass by
*   reference. The arrays head = {null} and tail = {null} are necessary
*   handles for tracking both the head and the tail of the LinkedList.
*   (A good alternative might be to have the recursive function
*   return a value.)
*
*************************************************************************/
Node[] head = {null}, tail = {null};
}
}

void toCircularDoublyLinkedList_recursive(Node n, Node[] h, Node[] t) {
if (null == n) {
return;
}
//left
if (null != n.left) {
}
//visit
if (null == h[0]) {
h[0] = t[0] = n;
} else {
t[0] = t[0].right;//reassign tail
}
//right
}```
```import org.junit.Test;
import static org.junit.Assert.*;

public class BSTTest {

/************************************************************************
* Description: Test the toCircularDoublyLinkedList_recursive function.
*   The trick here is to avoid falling into an endless loop as the tree
*   is now a circular structure with no definite end points.
*
* Technical Details: From a testing viewpoint
*
************************************************************************/
@Test
BST bst = new BST();
int[] treeTape = {200, 100, 300, 50, 150, 250, 350, 25, 75, 125,
175, 225, 275, 325, 375, 35, 212, 312, 400};
//set expectation
Integer[] ino = {35, 25, 75, 50, 125, 175, 150, 100, 212, 225, 275, 250,
312, 325, 400, 375, 350, 300, 200};
Arrays.sort(ino);//mergesort: like inorder

for (int i : treeTape) {
}
assertEquals(treeTape.length, bst.size());//has correct size