Changeset View
Changeset View
Standalone View
Standalone View
java/src/test/java/org/softwareheritage/graph/AllowedEdgesTest.java
package org.softwareheritage.graph; | package org.softwareheritage.graph; | ||||
import org.junit.jupiter.api.Assertions; | import org.junit.jupiter.api.Assertions; | ||||
import org.junit.jupiter.api.Test; | import org.junit.jupiter.api.Test; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
public class AllowedEdgesTest extends GraphTest { | public class AllowedEdgesTest extends GraphTest { | ||||
static class EdgeType { | static class EdgeType { | ||||
Node.Type src; | Node.Type src; | ||||
Node.Type dst; | Node.Type dst; | ||||
public EdgeType(Node.Type src, Node.Type dst) { | public EdgeType(Node.Type src, Node.Type dst) { | ||||
this.src = src; | this.src = src; | ||||
this.dst = dst; | this.dst = dst; | ||||
} | } | ||||
@Override | @Override | ||||
public boolean equals(Object otherObj) { | public boolean equals(Object otherObj) { | ||||
if (otherObj == this) return true; | if (otherObj == this) | ||||
if (!(otherObj instanceof EdgeType)) return false; | return true; | ||||
if (!(otherObj instanceof EdgeType)) | |||||
return false; | |||||
EdgeType other = (EdgeType) otherObj; | EdgeType other = (EdgeType) otherObj; | ||||
return src == other.src && dst == other.dst; | return src == other.src && dst == other.dst; | ||||
} | } | ||||
} | } | ||||
void assertEdgeRestriction(AllowedEdges edges, ArrayList<EdgeType> expectedAllowed) { | void assertEdgeRestriction(AllowedEdges edges, ArrayList<EdgeType> expectedAllowed) { | ||||
Node.Type[] nodeTypes = Node.Type.values(); | Node.Type[] nodeTypes = Node.Type.values(); | ||||
▲ Show 20 Lines • Show All 82 Lines • Show Last 20 Lines |