### Question:
ElementFactory { public Set<Edge> createEdges(ObjectFactBindingEntity inBinding) { ObjectUtils.notNull(inBinding, "'inBinding' is null!"); FactEntity fact = owner.getFactManager().getFact(inBinding.getFactID()); if (fact == null || !owner.hasFactAccess(fact)) { return new HashSet<>(); } if (CollectionUtils.size(fact.getBindings()) == 1 && Objects.equals(fact.getBindings().get(0).getObjectID(), inBinding.getObjectID())) { return SetUtils.set(createAndCache(inBinding.getFactID(), inBinding.getObjectID(), inBinding.getObjectID())); } Set<Edge> edges = new HashSet<>(); for (FactEntity.FactObjectBinding outBinding : ListUtils.list(fact.getBindings())) { if (Objects.equals(outBinding.getObjectID(), inBinding.getObjectID())) continue; if ((inBinding.getDirection() == Direction.BiDirectional && outBinding.getDirection() == Direction.BiDirectional) || (inBinding.getDirection() == Direction.FactIsDestination && outBinding.getDirection() == Direction.FactIsSource)) { edges.add(createAndCache(inBinding.getFactID(), inBinding.getObjectID(), outBinding.getObjectID())); } if (inBinding.getDirection() == Direction.FactIsSource && outBinding.getDirection() == Direction.FactIsDestination) { edges.add(createAndCache(inBinding.getFactID(), outBinding.getObjectID(), inBinding.getObjectID())); } } return edges; } private  ElementFactory(ActGraph owner); Set<Edge> createEdges(ObjectFactBindingEntity inBinding); Edge getEdge(UUID id); Vertex getVertex(UUID id); static Builder builder();  }### Answer:
@Test(expected = RuntimeException.class) public void testCreateEdgesWithoutBinding() { elementFactory.createEdges(null); }
@Test public void testCreateEdgesWithoutFact() { ObjectFactBindingEntity binding = createInBinding(Direction.BiDirectional); assertTrue(elementFactory.createEdges(binding).isEmpty()); }
@Test public void testCreateEdgesReturnsLoop() { ObjectFactBindingEntity inBinding = createInBinding(Direction.FactIsDestination); FactEntity.FactObjectBinding outBinding = new FactEntity.FactObjectBinding() .setObjectID(inBinding.getObjectID()) .setDirection(inBinding.getDirection()); mockObject(inBinding); mockFact(inBinding.getFactID(), outBinding); Edge edge = elementFactory.createEdges(inBinding).iterator().next(); assertSame(edge.inVertex(), edge.outVertex()); }