Skip to content

Commit

Permalink
Merge pull request #5 from LeonardoTPereira/CreateUnitTests
Browse files Browse the repository at this point in the history
Fix unit tests in Edge
  • Loading branch information
LeonardoTPereira authored Jul 10, 2021
2 parents 625f886 + 23f930a commit a7d24c7
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/test/java/graph/EdgeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,18 @@ void constructorWeight()
@Test
void constructorWeightAndDestination()
{
Edge edge = new Edge(new Vertex("A"), 1.5f);
Vertex vertex = new Vertex("A");
Edge edge = new Edge(vertex, 1.5f);
assertEquals(1.5f, edge.getWeight());
assertEquals(new Vertex("A"), edge.getDestination());
assertEquals(vertex, edge.getDestination());
}

@Test
void getDestination()
{
Edge edge = new Edge(new Vertex("A"), 1.5f);
assertEquals(new Vertex("A"), edge.getDestination());
Vertex vertex = new Vertex("A");
Edge edge = new Edge(vertex, 1.5f);
assertEquals(vertex, edge.getDestination());
}

@Test
Expand All @@ -34,7 +36,7 @@ void setDestination()
Vertex vertex = new Vertex("A");
Edge edge = new Edge(1.5f);
edge.setDestination(vertex);
assertEquals(new Vertex("A"), edge.getDestination());
assertEquals(vertex, edge.getDestination());
}

@Test
Expand Down

0 comments on commit a7d24c7

Please sign in to comment.