diff --git a/solrdf/pom.xml b/solrdf/pom.xml index c840914..ab5c0b2 100644 --- a/solrdf/pom.xml +++ b/solrdf/pom.xml @@ -14,6 +14,7 @@ 1.6.6 4.11 1.9.5-rc1 + 4.11 4.8.0 @@ -75,6 +76,12 @@ commons-logging 1.2 + + junit + junit + ${junit.version} + test + diff --git a/solrdf/src/main/java/org/gazzax/labs/solrdf/handler/update/FieldInjectorRegistry.java b/solrdf/src/main/java/org/gazzax/labs/solrdf/handler/update/FieldInjectorRegistry.java index 76632a6..4e66086 100644 --- a/solrdf/src/main/java/org/gazzax/labs/solrdf/handler/update/FieldInjectorRegistry.java +++ b/solrdf/src/main/java/org/gazzax/labs/solrdf/handler/update/FieldInjectorRegistry.java @@ -61,7 +61,7 @@ public void inject(final SolrInputDocument document, final Object value) { } }; - private final Map injectors = new HashMap(); + final Map injectors = new HashMap(); { injectors.put(XSDDatatype.XSDboolean.getURI(), booleanFieldInjector); diff --git a/solrdf/src/test/java/org/gazzax/labs/solrdf/handler/update/FieldInjectorRegistryTestCase.java b/solrdf/src/test/java/org/gazzax/labs/solrdf/handler/update/FieldInjectorRegistryTestCase.java new file mode 100644 index 0000000..17cd3fe --- /dev/null +++ b/solrdf/src/test/java/org/gazzax/labs/solrdf/handler/update/FieldInjectorRegistryTestCase.java @@ -0,0 +1,38 @@ +package org.gazzax.labs.solrdf.handler.update; + +import static org.junit.Assert.assertSame; + +import java.util.Map.Entry; + +import org.gazzax.labs.solrdf.handler.update.FieldInjectorRegistry.FieldInjector; +import org.junit.Before; +import org.junit.Test; + +/** + * Test case for {@link FieldInjectorRegistry}. + * + * @author Andrea Gazzarini + * @since 1.0 + */ +public class FieldInjectorRegistryTestCase { + private FieldInjectorRegistry cut; + + @Before + public void setUp() { + cut = new FieldInjectorRegistry(); + } + + /** + * If an injector has been registered for a given datatype then it must be returned. + */ + @Test + public void registeredInjector() { + for (final Entry entry : cut.injectors.entrySet()) { + final String dataTypeURI = entry.getKey(); + final FieldInjector result = cut.get(dataTypeURI); + assertSame(entry.getValue(), result); + } + + assertSame(cut.catchAllInjector(), cut.get(null)); + } +} \ No newline at end of file