@Test
public void open_importer() throws Exception {
DataModelSourceProvider provider = new SpiDataModelSourceProvider(getClass().getClassLoader());
URI uri = new URI("windgate:" + MockImporter.class.getName());
ValueDefinition<String> definition = ValueDefinition.of(String.class);
DataModelSource source = provider.open(definition, uri, EMPTY);
try {
DataModelReflection r1 = source.next();
assertThat(r1, is(notNullValue()));
assertThat(definition.toObject(r1), is("Hello1, world!"));
DataModelReflection r2 = source.next();
assertThat(r2, is(notNullValue()));
assertThat(definition.toObject(r2), is("Hello2, world!"));
DataModelReflection r3 = source.next();
assertThat(r3, is(notNullValue()));
assertThat(definition.toObject(r3), is("Hello3, world!"));
DataModelReflection r4 = source.next();
assertThat(r4, is(nullValue()));
} finally {
source.close();
}
}