use of org.eclipse.rdf4j.model.impl.SimpleNamespace in project rdf4j by eclipse.
the class NamespacesTest method testWrapContainsValue.
/**
* Test method for {@link org.eclipse.rdf4j.model.util.Namespaces#wrap(java.util.Set)}.
*/
@Test
public final void testWrapContainsValue() throws Exception {
Set<Namespace> testSet = new LinkedHashSet<Namespace>();
Map<String, String> testMap = Namespaces.wrap(testSet);
// Check no exceptions when calling containsKey on empty backing set
assertFalse(testMap.containsValue(testName1));
testSet.add(new SimpleNamespace(testPrefix1, testName1));
assertTrue(testMap.containsValue(testName1));
testSet.clear();
assertFalse(testMap.containsValue(testName1));
}
use of org.eclipse.rdf4j.model.impl.SimpleNamespace in project rdf4j by eclipse.
the class NamespacesTest method testWrapIsEmpty.
/**
* Test method for {@link org.eclipse.rdf4j.model.util.Namespaces#wrap(java.util.Set)}.
*/
@Test
public final void testWrapIsEmpty() throws Exception {
Set<Namespace> testSet = new LinkedHashSet<Namespace>();
Map<String, String> testMap = Namespaces.wrap(testSet);
assertTrue(testMap.isEmpty());
testSet.add(new SimpleNamespace(testPrefix1, testName1));
assertFalse(testMap.isEmpty());
testSet.clear();
assertTrue(testMap.isEmpty());
}
use of org.eclipse.rdf4j.model.impl.SimpleNamespace in project rdf4j by eclipse.
the class NamespacesTest method testWrapGet.
/**
* Test method for {@link org.eclipse.rdf4j.model.util.Namespaces#wrap(java.util.Set)}.
*/
@Test
public final void testWrapGet() throws Exception {
Set<Namespace> testSet = new LinkedHashSet<Namespace>();
Map<String, String> testMap = Namespaces.wrap(testSet);
assertNull(testMap.get(testPrefix1));
testSet.add(new SimpleNamespace(testPrefix1, testName1));
assertEquals(testName1, testMap.get(testPrefix1));
testSet.clear();
assertNull(testMap.get(testPrefix1));
}
use of org.eclipse.rdf4j.model.impl.SimpleNamespace in project rdf4j by eclipse.
the class NamespacesTest method testWrapValues.
/**
* Test method for {@link org.eclipse.rdf4j.model.util.Namespaces#wrap(java.util.Set)}.
*/
@Test
public final void testWrapValues() throws Exception {
Set<Namespace> testSet = new LinkedHashSet<Namespace>();
Map<String, String> testMap = Namespaces.wrap(testSet);
Collection<String> values1 = testMap.values();
assertNotNull(values1);
assertTrue(values1.isEmpty());
testSet.add(new SimpleNamespace(testPrefix1, testName1));
Collection<String> values2 = testMap.values();
assertNotNull(values2);
assertFalse(values2.isEmpty());
assertEquals(1, values2.size());
String nextValue = values2.iterator().next();
assertEquals(testName1, nextValue);
testSet.clear();
Collection<String> values3 = testMap.values();
assertNotNull(values3);
assertTrue(values3.isEmpty());
}
use of org.eclipse.rdf4j.model.impl.SimpleNamespace in project rdf4j by eclipse.
the class NamespacesTest method testWrapClear.
/**
* Test method for {@link org.eclipse.rdf4j.model.util.Namespaces#wrap(java.util.Set)}.
*/
@Test
public final void testWrapClear() throws Exception {
Set<Namespace> testSet = new LinkedHashSet<Namespace>();
Map<String, String> testMap = Namespaces.wrap(testSet);
// Check no exceptions when calling clear on empty backing set
testMap.clear();
testSet.add(new SimpleNamespace(testPrefix1, testName1));
assertFalse(testMap.isEmpty());
assertEquals(1, testMap.size());
testMap.clear();
assertTrue(testMap.isEmpty());
assertEquals(0, testMap.size());
}
Aggregations