generated from cuioss/cui-java-module-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moving logic for loading resourcebUndle to Interfaces
- Loading branch information
Showing
6 changed files
with
94 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...al-common-cdi/src/test/java/de/cuioss/portal/common/bundle/ResourceBundleLocatorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package de.cuioss.portal.common.bundle; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
import java.util.Locale; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import de.cuioss.portal.common.bundle.support.HighPrioBundles; | ||
import de.cuioss.portal.common.bundle.support.InvalidBundelPath; | ||
import de.cuioss.portal.common.bundle.support.MissingBundle; | ||
|
||
class ResourceBundleLocatorTest { | ||
|
||
@Test | ||
void shouldHandleHappyCase() { | ||
assertTrue(new HighPrioBundles().getBundle(Locale.GERMANY).isPresent()); | ||
} | ||
|
||
@Test | ||
void shouldHandleMissingPath() { | ||
assertFalse(new MissingBundle().getBundle(Locale.GERMANY).isPresent()); | ||
} | ||
|
||
@Test | ||
void shouldHandleInvalidPath() { | ||
assertFalse(new InvalidBundelPath().getBundle(Locale.GERMANY).isPresent()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...al-common-cdi/src/test/java/de/cuioss/portal/common/bundle/support/InvalidBundelPath.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package de.cuioss.portal.common.bundle.support; | ||
|
||
import java.util.Optional; | ||
|
||
import de.cuioss.portal.common.bundle.ResourceBundleLocator; | ||
|
||
public class InvalidBundelPath implements ResourceBundleLocator { | ||
|
||
private static final long serialVersionUID = 5363360633544306322L; | ||
|
||
@Override | ||
public Optional<String> getBundlePath() { | ||
return Optional.of("de.not.there"); | ||
} | ||
|
||
} |