user data factory pattern
diff --git a/src/test/java/UserdataTest.java b/src/test/java/UserdataTest.java
index fc9e27e..a10a480 100644
--- a/src/test/java/UserdataTest.java
+++ b/src/test/java/UserdataTest.java
@@ -1,9 +1,9 @@
import de.ids_mannheim.korap.config.BeanConfiguration;
-import de.ids_mannheim.korap.user.KorAPUser;
-import de.ids_mannheim.korap.user.User;
-import de.ids_mannheim.korap.user.UserDetailsDao;
-import de.ids_mannheim.korap.user.Userdetails2;
-import org.junit.*;
+import de.ids_mannheim.korap.user.*;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
/**
* @author hanl
@@ -58,4 +58,21 @@
assert "value is a value".equals(d.get("key_1"));
}
+ @Test
+ public void testUserdatafactory() {
+ UserDataDbIface dao = UserdataFactory
+ .getDaoInstance(Userdetails2.class);
+ assert UserDetailsDao.class.equals(dao.getClass());
+ }
+
+ @Test(expected = RuntimeException.class)
+ public void testUserdatafactoryError() {
+ UserdataFactory.getDaoInstance(new Userdata(1) {
+ @Override
+ public String[] requiredFields() {
+ return new String[0];
+ }
+ }.getClass());
+ }
+
}
diff --git a/src/test/java/de/ids_mannheim/korap/config/ConfigTest.java b/src/test/java/de/ids_mannheim/korap/config/ConfigTest.java
index ded5cff..d4f2ad5 100644
--- a/src/test/java/de/ids_mannheim/korap/config/ConfigTest.java
+++ b/src/test/java/de/ids_mannheim/korap/config/ConfigTest.java
@@ -6,8 +6,6 @@
import de.ids_mannheim.korap.security.ac.ResourceFinder;
import de.ids_mannheim.korap.user.Attributes;
import de.ids_mannheim.korap.user.User;
-import de.ids_mannheim.korap.user.UserdataFactory;
-import de.ids_mannheim.korap.user.Userdetails2;
import de.ids_mannheim.korap.utils.ServiceVersion;
import de.ids_mannheim.korap.utils.TimeUtils;
import org.junit.After;
@@ -78,11 +76,6 @@
BeanConfiguration.getBeans().getEncryption()
.validateEntry(v, Attributes.EMAIL);
}
-
- @Test
- public void testTypeReference() {
- UserdataFactory.getInstance(Userdetails2.class);
- }
}