blob: 207ef8197879d00d4ea2c721b589ae54e90ae58c [file] [log] [blame]
Michael Hanl1e18cb42015-08-06 20:57:35 +02001import de.ids_mannheim.korap.config.BeanConfiguration;
Michael Hanl0f6ffd72015-08-27 19:23:15 +02002import de.ids_mannheim.korap.config.DefaultHandler;
Michael Hanl1e18cb42015-08-06 20:57:35 +02003import de.ids_mannheim.korap.interfaces.AuditingIface;
4import de.ids_mannheim.korap.interfaces.defaults.DefaultAuditing;
5import org.junit.Test;
6
7/**
8 * @author hanl
9 * @date 27/07/2015
10 */
11public class ClassLoaderTest {
12
13 @Test
14 public void testBeanConfigurationLoaderThrowsNoException() {
15 BeanConfiguration.loadClasspathContext("classpath-config.xml");
16 assert BeanConfiguration.getBeans() != null;
17 }
18
19 @Test
20 public void testDefaultCreationThrowsNoException() {
Michael Hanl0f6ffd72015-08-27 19:23:15 +020021 DefaultHandler pl = new DefaultHandler();
Michael Hanl1e18cb42015-08-06 20:57:35 +020022 Object o = pl.getDefault(BeanConfiguration.KUSTVAKT_AUDITING);
23 assert o != null;
Michael Hanl0f6ffd72015-08-27 19:23:15 +020024 assert o instanceof AuditingIface;
Michael Hanl1e18cb42015-08-06 20:57:35 +020025 }
26
27 @Test(expected = RuntimeException.class)
28 public void testDefaultCreationThrowsException() {
29 BeanConfiguration.loadClasspathContext();
30 BeanConfiguration.getBeans().getAuthenticationManager();
31 }
32
33 @Test
34 public void testDefaultInterfaceMatchThrowsNoException() {
35 BeanConfiguration.loadClasspathContext();
36 AuditingIface iface = BeanConfiguration.getBeans()
37 .getAuditingProvider();
38 assert iface != null;
39 assert iface instanceof DefaultAuditing;
40 }
41
42}