diff options
author | Thomas Lenz <thomas.lenz@egiz.gv.at> | 2020-02-06 18:04:31 +0100 |
---|---|---|
committer | Thomas Lenz <thomas.lenz@egiz.gv.at> | 2020-02-06 18:04:31 +0100 |
commit | f2c665c55e115d919cf1a752ef2f7c9f01f51ce3 (patch) | |
tree | e880f7b0275bd97ec4fd70a8de2dca096b8f9719 /eaaf_core | |
parent | 98a83cbb3f5eca50388f3d5f64fe1d760bc199d7 (diff) | |
download | EAAF-Components-f2c665c55e115d919cf1a752ef2f7c9f01f51ce3.tar.gz EAAF-Components-f2c665c55e115d919cf1a752ef2f7c9f01f51ce3.tar.bz2 EAAF-Components-f2c665c55e115d919cf1a752ef2f7c9f01f51ce3.zip |
add more jUnit test
Diffstat (limited to 'eaaf_core')
-rw-r--r-- | eaaf_core/pom.xml | 7 | ||||
-rw-r--r-- | eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/EaafCoreSpringResourceProviderTest.java | 56 |
2 files changed, 63 insertions, 0 deletions
diff --git a/eaaf_core/pom.xml b/eaaf_core/pom.xml index 5e988c05..28ce135c 100644 --- a/eaaf_core/pom.xml +++ b/eaaf_core/pom.xml @@ -87,6 +87,7 @@ <artifactId>xalan</artifactId> </dependency> + <!-- For testing --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> @@ -97,6 +98,12 @@ <artifactId>spring-test</artifactId> <scope>test</scope> </dependency> + <dependency> + <groupId>at.gv.egiz.eaaf</groupId> + <artifactId>eaaf_core_utils</artifactId> + <scope>test</scope> + <type>test-jar</type> + </dependency> </dependencies> <build> diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/EaafCoreSpringResourceProviderTest.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/EaafCoreSpringResourceProviderTest.java new file mode 100644 index 00000000..cbe8d815 --- /dev/null +++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/EaafCoreSpringResourceProviderTest.java @@ -0,0 +1,56 @@ +package at.gv.egiz.eaaf.core.impl.idp.auth; + +import java.io.IOException; +import java.io.InputStream; + +import org.apache.commons.io.IOUtils; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.BlockJUnit4ClassRunner; +import org.springframework.core.io.Resource; + +import at.gv.egiz.eaaf.core.impl.idp.EaafCoreSpringResourceProvider; +import at.gv.egiz.eaaf.core.test.TestConstants; + + + +@RunWith(BlockJUnit4ClassRunner.class) +public class EaafCoreSpringResourceProviderTest { + + @Test + public void testSpringConfig() { + final EaafCoreSpringResourceProvider test = + new EaafCoreSpringResourceProvider(); + for (final Resource el : test.getResourcesToLoad()) { + try { + IOUtils.toByteArray(el.getInputStream()); + + } catch (final IOException e) { + Assert.fail("Ressouce: " + el.getFilename() + " not found"); + } + + } + + Assert.assertNotNull("no Name", test.getName()); + Assert.assertNull("Find package definitions", test.getPackagesToScan()); + + } + + @Test + public void testSpILoaderConfig() { + final InputStream el = this.getClass().getResourceAsStream(TestConstants.TEST_SPI_LOADER_PATH); + try { + final String spiFile = IOUtils.toString(el, "UTF-8"); + + Assert.assertEquals("Wrong classpath in SPI file", + EaafCoreSpringResourceProvider.class.getName(), spiFile); + + + } catch (final IOException e) { + Assert.fail("Ressouce: " + TestConstants.TEST_SPI_LOADER_PATH + " not found"); + + } + } + +} |