Created
November 16, 2011 22:46
-
-
Save okram/1371740 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.cisco.hmp.graph.gui; | |
import com.tinkerpop.blueprints.pgm.Edge; | |
import com.tinkerpop.blueprints.pgm.Graph; | |
import com.tinkerpop.blueprints.pgm.impls.tg.TinkerGraphFactory; | |
import junit.framework.TestCase; | |
import java.util.Arrays; | |
/** | |
* @author Marko A. Rodriguez (http://markorodriguez.com) | |
*/ | |
public class GuiHelperTest extends TestCase { | |
public void testResultBundle() { | |
Graph graph = TinkerGraphFactory.createTinkerGraph(); | |
GuiHelper gui = new GuiHelper(graph); | |
assertNull(gui.getAdjacencies(0, Arrays.asList("name", "age"))); | |
GuiHelper.ResultBundle bundle = gui.getAdjacencies(1, Arrays.asList("name", "age")); | |
assertEquals(bundle.properties.size(), 2); | |
assertEquals(bundle.properties.get("name"), "marko"); | |
assertEquals(bundle.properties.get("age"), 29); | |
assertFalse(bundle.incoming.iterator().hasNext()); | |
assertTrue(bundle.outgoing.iterator().hasNext()); | |
int counter =0; | |
for(Edge edge : bundle.outgoing) { | |
counter++; | |
assertTrue(edge.getLabel().equals("knows") || edge.getLabel().equals("created")); | |
assertTrue(edge.getInVertex().getId().equals("2") || edge.getInVertex().getId().equals("3") || edge.getInVertex().getId().equals("4")); | |
} | |
assertEquals(counter,3); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment