Package primitiveTests

Source Code of primitiveTests.GraphTest

package primitiveTests;

import static org.junit.Assert.*;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;

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

import primitives.graph.Graph;
import primitives.graph.Node;
import primitives.graph.Transition;

public class GraphTest {
  Graph master = new Graph();
 
  Node in = new Node();
 
  @Before
  public void setUp(){
    master.addNode(in);
    master.connect(in, in);
    master.connect(in,in,"one");
    master.connect(in, in, "two");
    master.connect(in, in);
  }

  @Test
  public void testGraph() {
    fail("Not yet implemented");
  }

  @Test
  public void testGraphSetOfNodeHashMapOfNodeSetOfTransition() {
    fail("Not yet implemented");
  }

  @Test
  public void testGetNodes() {
    assertEquals(1,master.getNodes().size());
  }

  @Test
  public void testSetNodes() {
    Set<Node> ooph = new HashSet<Node>();
    ooph.add( new Node ("test"));
    Set<Node> oldOnes = master.getNodes();
    HashMap<Node,Set<Transition>> oldTransitions = master.getTransitions();
    assertEquals(1,master.getNodes().size());
    master.setNodes(ooph);
    assertEquals(ooph.size(),master.getNodes().size());
    assertSame(ooph,master.getNodes());
    master.setNodes(oldOnes);
    assertFalse(ooph == master.getNodes());
    assertSame(oldOnes,master.getNodes());
    Graph someOtherGraph = new Graph();
    Node a, b;
    a = new Node("a");
    b = new Node("b");
    someOtherGraph.addNode(a);
    someOtherGraph.addNode(b);
    someOtherGraph.connect(a, b, "test");
   
    assertTrue(someOtherGraph.connectivity(a, b));
    assertTrue(a.pathTo(b));
    Set<Node> newOnes = someOtherGraph.getNodes();
   
    master.setNodes(newOnes);
   
    assertFalse(master.getNodes().contains(in));
   
    assertTrue(master.connectivity(a, b));
   
    master.setNodes(oldOnes);
    assertEquals(oldTransitions.size(),master.getTransitions().size());
   
  }

  @Test
  public void testGetTransitions() {
    fail("Not yet implemented");
  }

  @Test
  public void testSetTransitions() {
    fail("Not yet implemented");
  }

  @Test
  public void testAddNodeString() {
    fail("Not yet implemented");
  }

  @Test
  public void testAddNodeNode() {
    fail("Not yet implemented");
  }

  @Test
  public void testConnectNodeNode() {
    fail("Not yet implemented");
  }

  @Test
  public void testConnectNodeNodeString() {
    fail("Not yet implemented");
  }

}
TOP

Related Classes of primitiveTests.GraphTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.