Test cases not passing

Can u tell me what is wrong with this piece of Code
why test cases are not passing

public void appendLastN(int n) throws Exception {
Node slow = this.head;
Node fast = this.head;
Node prev = null;
for (int i = 1; i <= n; i++) {
fast = fast.next;
}
while (fast != null) {
prev = slow;
slow = slow.next;
fast = fast.next;
}
Node temp = this.head;
this.head = slow;
this.tail.next = temp;
this.tail = prev;
this.tail.next = null;
}

I got all test cases but one test case is still failing it is showing no output! (I just add n=n%this.size;)

think about the case when n = 0. your slow and fast both will be null, which would make head pointer null and therefore its printing nothing.
handle this case separately. like if n==0 return;
Thanks.