1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.commons.rdf.api;
19
20 import static org.junit.Assert.*;
21
22 import org.junit.Test;
23
24 public class DummyGraphTest {
25 Graph graph = new DummyGraph();
26
27 @Test
28 public void add() throws Exception {
29 graph.add(new DummyTriple());
30 }
31
32 @Test
33 public void addSPO() throws Exception {
34 graph.add(new DummyIRI(1), new DummyIRI(2), new DummyIRI(3));
35 }
36
37 @Test
38 public void contains() throws Exception {
39 assertTrue(graph.contains(new DummyTriple()));
40 }
41
42 @Test
43 public void containsSPO() throws Exception {
44 assertTrue(graph.contains(null, null, null));
45 assertTrue(graph.contains(new DummyIRI(1), new DummyIRI(2), new DummyIRI(3)));
46 assertFalse(graph.contains(new DummyIRI(0), new DummyIRI(0), new DummyIRI(0)));
47 }
48
49 @Test(expected = IllegalStateException.class)
50 public void clearNotSupported() throws Exception {
51 graph.clear();
52 }
53
54 @Test(expected = IllegalStateException.class)
55 public void remove() throws Exception {
56 graph.remove(new DummyTriple());
57 }
58
59 @Test
60 public void removeSPO() throws Exception {
61 graph.remove(new DummyIRI(0), new DummyIRI(0), new DummyIRI(0));
62 }
63
64 @Test
65 public void size() throws Exception {
66 assertEquals(1, graph.size());
67 }
68
69 @Test
70 public void stream() throws Exception {
71 assertEquals(new DummyTriple(), graph.stream().findAny().get());
72 }
73
74 @Test
75 public void streamFiltered() throws Exception {
76 assertEquals(new DummyTriple(), graph.stream(null, null, null).findAny().get());
77 assertEquals(new DummyTriple(),
78 graph.stream(new DummyIRI(1), new DummyIRI(2), new DummyIRI(3)).findAny().get());
79 assertFalse(graph.stream(new DummyIRI(0), new DummyIRI(0), new DummyIRI(0)).findAny().isPresent());
80 }
81
82
83
84 }