Skip to content

Commit

Permalink
Improved DefaultGraphSubjects null-check and unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ajs6f committed Oct 20, 2013
1 parent 9c5ff8c commit 3c68475
Showing 1 changed file with 10 additions and 2 deletions.
Expand Up @@ -20,6 +20,7 @@
import static org.fcrepo.kernel.RdfLexicon.RESTAPI_NAMESPACE;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.mockito.MockitoAnnotations.initMocks;
Expand Down Expand Up @@ -82,8 +83,8 @@ public void testGetNodeFromGraphSubject() throws RepositoryException {
actual = testObj.getNodeFromGraphSubject(mockSubject);
assertEquals("Somehow got a Node from a bad RDF subject!", null, actual);
// test a non-existent path
when(mockSubject.getURI())
.thenReturn("info:fedora" + expected + "/bad");
when(mockSubject.getURI()).thenReturn(
RESTAPI_NAMESPACE + expected + "/bad");
actual = testObj.getNodeFromGraphSubject(mockSubject);
assertEquals("Somehow got a Node from a non-existent RDF subject!",
null, actual);
Expand Down Expand Up @@ -117,4 +118,11 @@ public void testIsFedoraGraphSubjectWithBlankNode() {
actual);
}

@Test
public void testGetContext() {
final Resource context = testObj.getContext();
assertTrue("Context was returned other than as an RDF blank node!",
context.isAnon());
}

}

0 comments on commit 3c68475

Please sign in to comment.