package ru.apetrov.Cycle;

import org.junit.Test;

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

/**
 * Created by Andrey on 17.03.2017.
 */
public class CycleTest {

    @Test
    public void whenThereIsCycleThenResultTrue() {
        Node first = new Node();
        Node two = new Node();
        Node third = new Node();
        Node four = new Node();

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

        Cycle cycle = new Cycle();
        assertThat(cycle.hasCycle(first), is(true));
    }
}
@@ -579,10 +579,406 @@
 );%0A    %7D
+%0A%0A    @Test%0A    public void whenThereIsNoCycleThenResultFalse() %7B%0A        Node first = new Node();%0A        Node two = new Node();%0A        Node third = new Node();%0A        Node four = new Node();%0A%0A        first.next = two;%0A        two.next = third;%0A        third.next = four;%0A        four.next = null;%0A%0A        Cycle cycle = new Cycle();%0A        assertThat(cycle.hasCycle(first), is(false));%0A    %7D
 %0A%7D

update Cycle