46 lines
No EOL
951 B
Java
46 lines
No EOL
951 B
Java
package ch.usi.inf.sp.graph;
|
|
|
|
import ch.usi.inf.sp.graph.Edge;
|
|
import ch.usi.inf.sp.graph.Node;
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
import static org.junit.jupiter.api.Assertions.*;
|
|
|
|
class EdgeTest {
|
|
|
|
@Test
|
|
void newEdge() {
|
|
Edge e = new Edge();
|
|
assertNull(e.getFrom());
|
|
assertNull(e.getTo());
|
|
}
|
|
|
|
@Test
|
|
void toStringTest() {
|
|
Node n1 = new Node();
|
|
Node n2 = new Node();
|
|
Edge e = new Edge();
|
|
e.setFrom(n1);
|
|
e.setTo(n2);
|
|
assertEquals(n1.toString()+" -> "+n2.toString(), e.toString());
|
|
}
|
|
|
|
@Test
|
|
void setFrom() {
|
|
Edge e = new Edge();
|
|
Node n = new Node();
|
|
e.setFrom(n);
|
|
assertEquals(n, e.getFrom());
|
|
assertNull(e.getTo());
|
|
}
|
|
|
|
@Test
|
|
void setTo() {
|
|
Edge e = new Edge();
|
|
Node n = new Node();
|
|
e.setTo(n);
|
|
assertEquals(n, e.getTo());
|
|
assertNull(e.getFrom());
|
|
}
|
|
|
|
} |