Graph Implemented

- added a new method in graph interface
- added method in the test
- graph implemented and pass all the tests
This commit is contained in:
2018-10-08 12:56:59 +02:00
parent 745b171594
commit c498b2b0e2
5 changed files with 590 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
package berack96.test.sim;
import berack96.sim.util.graph.Graph;
import berack96.sim.util.graph.MapGraph;
import berack96.sim.util.graph.visit.BFS;
import berack96.sim.util.graph.visit.DFS;
import berack96.sim.util.graph.visit.VisitStrategy;
@@ -21,7 +22,7 @@ public class TestGraph {
@Before
public void before() {
// Change here the instance for changing all the test for that particular class
graph = null;
graph = new MapGraph<>();
}
@Test
@@ -312,6 +313,14 @@ public class TestGraph {
new Graph.Edge<>("4", "6", 6),
new Graph.Edge<>("5", "3", 9),
new Graph.Edge<>("5", "4", 5));
shouldThrow(nullException, () -> graph.edgesOf(null));
shouldThrow(notException, () -> graph.edgesOf("rew"));
shouldContain(graph.edgesOf("5"),
new Graph.Edge<>("2", "5", 4),
new Graph.Edge<>("3", "5", 2),
new Graph.Edge<>("5", "3", 9),
new Graph.Edge<>("5", "4", 5));
}
@Test