* added static factory method to ease instantiation of a new registry
* adapted unit test accordingly * polished !JavaDocs a little git-svn-id: svn+ssh://svn.synyx.de/var/svn/synyx/opensource/synyx-plugin/trunk@3010 5a64d73e-33d6-4ccc-9058-23f8668ecac9
This commit is contained in:
@@ -20,7 +20,7 @@ public class PluginRegistry<T extends Plugin<S>, S> implements Iterable<T> {
|
||||
|
||||
|
||||
/**
|
||||
* Constructor of {@code PluginRegistry}.
|
||||
* Creates a new {@code PluginRegistry}.
|
||||
*/
|
||||
public PluginRegistry() {
|
||||
|
||||
@@ -28,6 +28,19 @@ public class PluginRegistry<T extends Plugin<S>, S> implements Iterable<T> {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new {@link PluginRegistry}.
|
||||
*
|
||||
* @param <T>
|
||||
* @param <S>
|
||||
* @return
|
||||
*/
|
||||
public static <T extends Plugin<S>, S> PluginRegistry<T, S> create() {
|
||||
|
||||
return new PluginRegistry<T, S>();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Register plugins.
|
||||
*
|
||||
|
||||
@@ -8,6 +8,11 @@ import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
/**
|
||||
* Unit test for {@link PluginRegistry}.
|
||||
*
|
||||
* @author Oliver Gierke - gierke@synyx.de
|
||||
*/
|
||||
public class PluginRegistryUnitTest {
|
||||
|
||||
private SamplePlugin provider;
|
||||
@@ -24,7 +29,7 @@ public class PluginRegistryUnitTest {
|
||||
|
||||
provider = new SamplePluginImplementation();
|
||||
|
||||
registry = new PluginRegistry<SamplePlugin, String>();
|
||||
registry = PluginRegistry.create();
|
||||
registry.setPlugins(Arrays.asList(provider));
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,8 @@ import org.synyx.plugin.core.SamplePlugin;
|
||||
|
||||
|
||||
/**
|
||||
* Integration test to simply check if the configuration gets parsed correctly.
|
||||
*
|
||||
* @author Oliver Gierke - gierke@synyx.de
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
|
||||
Reference in New Issue
Block a user