package graph;

import junit.framework.TestCase;

public class TestGraph extends TestCase {
  public static void main(String[] args) {
    junit.textui.TestRunner.main(new String[] { "graph.TestGraph" });
  }

  /**
   * Class constructor.
   * @param name the name of the test.
   */
  public TestGraph(final String name) {
    super(name);
  }

  /**
   * Example of a test. Just tests if 2 + 2 == 4.
   * @throws Exception in case an error happens.
   */
  public final void testAddNode() throws Exception {
    Graph<String> g = new GraphImpl<String>();
    g.add("abelha");
    assertEquals(g.contains("abelha"), true);
  }

  /**
   * Example of a test. Just tests if 2 + 2 == 4.
   * @throws Exception in case an error happens.
   */
  public final void testAddLink() throws Exception {
    Graph<String> g = new GraphImpl<String>();
    g.add("abelha");
    g.add("vespa");
    g.link("abelha", "vespa");
    assertEquals(g.contains("abelha"), true);
    assertEquals(g.contains("vespa"), true);
    assertEquals(g.neighbors("abelha", "vespa"), true);
    assertEquals(g.neighbors("vespa", "abelha"), true);
  }

}
