package ru.matevosyan;

import org.junit.Test;
import ru.matevosyan.CycleDetection.Node;

import static org.hamcrest.core.Is.is;
import static org.junit.Assert.*;

/**
 * Created by Пользователь on 26.05.2017.
 */
public class CycleDetectionTest {

    @Test
    public void WhenCreateCycleListThanDetectIt() {

        CycleDetection<Integer> cycleDetection = new CycleDetection<>();

        Node<Integer> first = new Node<>(1);
        Node<Integer> two = new Node<>(2);
        Node<Integer> third = new Node<>(3);
        Node<Integer> four = new Node<>(4);

        first.next = two;
        two.next = third;
        third.next = four;
        four.next = first;

        boolean hasCycle = cycleDetection.hasCycle(first);

        assertThat(hasCycle, is(true));
    }
}
@@ -169,50 +169,109 @@
  * C
-reated by %D0%9F%D0%BE%D0%BB%D1%8C%D0%B7%D0%BE%D0%B2%D0%B0%D1%82%D0%B5%D0%BB%D1%8C on 26.05.2017.
+ycleDetectionTest class.%0A * Created on 26.05.2017.%0A * @author Matevosyan Vardan%0A * @version 1.0
 %0A */%0A
+%0A
 publ
@@ -297,24 +297,190 @@
 tionTest %7B%0A%0A
+    /**%0A     * Create WhenCreateCycleListThanDetectItAsTrue() to test cycle linked list.%0A     * When last element is pointer to the first, than return true.%0A     */%0A%0A
     @Test%0A  
@@ -528,13 +528,36 @@
 ctIt
-() %7B%0A
+AsTrue() %7B%0A%0A        //assign
 %0A   
@@ -801,24 +801,57 @@
 Node%3C%3E(4);%0A%0A
+        // 1 -%3E 2 -%3E 3 -%3E 4 -%3E 1%0A
         firs
@@ -945,16 +945,30 @@
 first;%0A%0A
+        //act%0A
         
@@ -1015,24 +1015,44 @@
 le(first);%0A%0A
+        //assertion%0A
         asse
@@ -1084,10 +1084,1602 @@
 );%0A    %7D
+%0A%0A    /**%0A     * Create WhenCreateCycleListAndCycleItemIsNotFirstThanDetectItAsTrue() to test cycle linked list.%0A     * When last element is pointer to the second, than return true.%0A     */%0A%0A    @Test%0A    public void WhenCreateCycleListAndCycleItemIsNotFirstThanDetectItAsTrue() %7B%0A%0A        //assign%0A        CycleDetection%3CInteger%3E cycleDetection = new CycleDetection%3C%3E();%0A%0A        Node%3CInteger%3E first = new Node%3C%3E(1);%0A        Node%3CInteger%3E two = new Node%3C%3E(2);%0A        Node%3CInteger%3E third = new Node%3C%3E(3);%0A        Node%3CInteger%3E four = new Node%3C%3E(4);%0A%0A        // 1 -%3E 2 -%3E 3 -%3E 4 -%3E 2%0A        first.next = two;%0A        two.next = third;%0A        third.next = four;%0A        four.next = two;%0A%0A        //act%0A        boolean hasCycle = cycleDetection.hasCycle(first);%0A%0A        //assign%0A        assertThat(hasCycle, is(true));%0A    %7D%0A%0A    /**%0A     * Create WhenCreateListWithoutCycleThanDetectItAsFalse() to test cycle linked list.%0A     * When last element have not next pointer, than return false.%0A     */%0A%0A    @Test%0A    public void WhenCreateListWithoutCycleThanDetectItAsFalse() %7B%0A%0A        //assign%0A        CycleDetection%3CInteger%3E cycleDetection = new CycleDetection%3C%3E();%0A%0A        Node%3CInteger%3E first = new Node%3C%3E(1);%0A        Node%3CInteger%3E two = new Node%3C%3E(2);%0A        Node%3CInteger%3E third = new Node%3C%3E(3);%0A        Node%3CInteger%3E four = new Node%3C%3E(4);%0A%0A        // 1 -%3E 2 -%3E 3 -%3E 4%0A        first.next = two;%0A        two.next = third;%0A        third.next = four;%0A%0A%0A        //act%0A        boolean hasCycle = cycleDetection.hasCycle(first);%0A%0A        //assign%0A        assertThat(hasCycle, is(false));%0A    %7D
 %0A%7D

add a few test and javadoc