/*
 * Copyright 2012-2014 JetBrains s.r.o
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package jetbrains.jetpad.model.composite;

import org.junit.Before;
import org.junit.Test;

import java.util.Arrays;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertSame;

public class TreePathTest {
  private TestComposite root = new TestComposite();
  private TestComposite child1 = new TestComposite();
  private TestComposite child2 = new TestComposite();

  @Before
  public void init() {
    root.children().addAll(Arrays.asList(child1, child2));
  }

  @Test
  public void saveRestore() {
    TreePath<TestComposite> path1 = new TreePath<TestComposite>(child1);

    assertSame(child1, path1.get(root));
  }

  @Test
  public void pathEquality() {
    assertEquals(new TreePath<TestComposite>(child1), new TreePath<TestComposite>(child1));
    assertNotEquals(new TreePath<TestComposite>(child2), new TreePath<TestComposite>(child1));
  }
}
@@ -713,16 +713,155 @@
 rrays;%0A%0A
+import static org.hamcrest.CoreMatchers.equalTo;%0Aimport static org.hamcrest.CoreMatchers.not;%0Aimport static org.hamcrest.CoreMatchers.not;%0A
 import s
@@ -934,25 +934,20 @@
 t.assert
-NotEquals
+Same
 ;%0Aimport
@@ -977,20 +977,20 @@
 t.assert
-Same
+That
 ;%0A%0Apubli
@@ -1477,22 +1477,20 @@
   assert
-Equals
+That
 (new Tre
@@ -1519,16 +1519,24 @@
 hild1), 
+equalTo(
 new Tree
@@ -1559,24 +1559,25 @@
 te%3E(child1))
+)
 ;%0A    assert
@@ -1580,17 +1580,12 @@
 sert
-NotEquals
+That
 (new
@@ -1618,16 +1618,28 @@
 hild2), 
+not(equalTo(
 new Tree
@@ -1666,15 +1666,17 @@
 child1))
+))
 ;%0A  %7D%0A%7D

fix sometimes failing test (junit removed assertNotEquals)