Michael Hanl | 1e18cb4 | 2015-08-06 20:57:35 +0200 | [diff] [blame] | 1 | import de.ids_mannheim.korap.config.BeanConfiguration; |
Michael Hanl | 0f6ffd7 | 2015-08-27 19:23:15 +0200 | [diff] [blame^] | 2 | import de.ids_mannheim.korap.config.DefaultHandler; |
Michael Hanl | 1e18cb4 | 2015-08-06 20:57:35 +0200 | [diff] [blame] | 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() { |
Michael Hanl | 0f6ffd7 | 2015-08-27 19:23:15 +0200 | [diff] [blame^] | 21 | DefaultHandler pl = new DefaultHandler(); |
Michael Hanl | 1e18cb4 | 2015-08-06 20:57:35 +0200 | [diff] [blame] | 22 | Object o = pl.getDefault(BeanConfiguration.KUSTVAKT_AUDITING); |
| 23 | assert o != null; |
Michael Hanl | 0f6ffd7 | 2015-08-27 19:23:15 +0200 | [diff] [blame^] | 24 | assert o instanceof AuditingIface; |
Michael Hanl | 1e18cb4 | 2015-08-06 20:57:35 +0200 | [diff] [blame] | 25 | } |
| 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 | } |