From a57a2ed851b818456421f3ce082dc6813da6b736 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Thu, 20 Feb 2020 09:43:03 +0100 Subject: add two jUnit test and CodeStyle modifications --- .../impl/idp/auth/EaafCoreMessageSourceTest.java | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/EaafCoreMessageSourceTest.java (limited to 'eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth') diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/EaafCoreMessageSourceTest.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/EaafCoreMessageSourceTest.java new file mode 100644 index 00000000..a354b873 --- /dev/null +++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/EaafCoreMessageSourceTest.java @@ -0,0 +1,41 @@ +package at.gv.egiz.eaaf.core.impl.idp.auth; + +import java.util.List; + +import at.gv.egiz.eaaf.core.api.logging.IMessageSourceLocation; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.io.Resource; +import org.springframework.core.io.ResourceLoader; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration({ "/eaaf_core.beans.xml", + "/SpringTest-context_eaaf_core.xml", + "/SpringTest-context_authManager.xml"}) +public class EaafCoreMessageSourceTest { + + @Autowired + private ResourceLoader loader; + @Autowired(required = false) + private List messageSources; + + @Test + public void checkMessageSources() { + Assert.assertNotNull("No messageSource", messageSources); + + for (final IMessageSourceLocation messageSource : messageSources) { + Assert.assertNotNull("No sourcePath", messageSource.getMessageSourceLocation()); + + for (final String el : messageSource.getMessageSourceLocation()) { + final Resource messages = loader.getResource(el + ".properties"); + Assert.assertTrue("Source not exist", messages.exists()); + + } + } + } +} -- cgit v1.2.3