Example #1
0
  @Test
  public void testNextWithReference() throws Exception {
    when(mockValue.getType()).thenReturn(PropertyType.REFERENCE);
    when(mockValue.getString()).thenReturn("uuid");
    when(mockSession.getNodeByIdentifier("uuid")).thenReturn(mockNode);
    when(mockGraphSubjects.getSubject(mockNode.getPath()))
        .thenReturn(ResourceFactory.createResource("http://localhost:8080/xyz"));
    final QuerySolution solution = testObj.next();

    assertEquals("http://localhost:8080/xyz", solution.get("a").asResource().getURI());
  }
Example #2
0
  @Test
  public void testNextWithResource() throws Exception {
    when(mockValue.getType()).thenReturn(PropertyType.PATH);
    when(mockValue.getString()).thenReturn("/x");
    when(mockGraphSubjects.getSubject("/x")).thenReturn(ResourceFactory.createResource("info:x"));
    final QuerySolution solution = testObj.next();

    assertTrue(solution.contains("a"));
    assertEquals("info:x", solution.get("a").asResource().getURI());
    assertEquals(solution.get("a"), solution.getResource("a"));
  }