Michael Hanl | 1e18cb4 | 2015-08-06 20:57:35 +0200 | [diff] [blame^] | 1 | import de.ids_mannheim.korap.config.BeanConfiguration; |
| 2 | import de.ids_mannheim.korap.config.PluginHandler; |
| 3 | import de.ids_mannheim.korap.interfaces.AuditingIface; |
| 4 | import de.ids_mannheim.korap.interfaces.defaults.DefaultAuditing; |
| 5 | import org.junit.Test; |
| 6 | |
| 7 | /** |
| 8 | * @author hanl |
| 9 | * @date 27/07/2015 |
| 10 | */ |
| 11 | public 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() { |
| 21 | PluginHandler pl = new PluginHandler(); |
| 22 | Object o = pl.getDefault(BeanConfiguration.KUSTVAKT_AUDITING); |
| 23 | assert o != null; |
| 24 | } |
| 25 | |
| 26 | @Test(expected = RuntimeException.class) |
| 27 | public void testDefaultCreationThrowsException() { |
| 28 | BeanConfiguration.loadClasspathContext(); |
| 29 | BeanConfiguration.getBeans().getAuthenticationManager(); |
| 30 | } |
| 31 | |
| 32 | @Test |
| 33 | public void testDefaultInterfaceMatchThrowsNoException() { |
| 34 | BeanConfiguration.loadClasspathContext(); |
| 35 | AuditingIface iface = BeanConfiguration.getBeans() |
| 36 | .getAuditingProvider(); |
| 37 | assert iface != null; |
| 38 | assert iface instanceof DefaultAuditing; |
| 39 | } |
| 40 | |
| 41 | } |