-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
André Laugks
committed
Apr 15, 2024
1 parent
65e61a7
commit 91dc5c6
Showing
10 changed files
with
110 additions
and
160 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
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
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
63 changes: 0 additions & 63 deletions
63
.../io/github/alaugks/spring/messagesource/xliff/ressources/ResourcesFileNameParserTest.java
This file was deleted.
Oops, something went wrong.
68 changes: 68 additions & 0 deletions
68
.../io/github/alaugks/spring/messagesource/xliff/ressources/ResourcesFilenameParserTest.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,68 @@ | ||
package io.github.alaugks.spring.messagesource.xliff.ressources; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertNull; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
import io.github.alaugks.spring.messagesource.xliff.ressources.ResourcesFileNameParser.Filename; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class ResourcesFilenameParserTest { | ||
|
||
@Test | ||
void test_domain_withoutLocale() { | ||
Filename filename = new ResourcesFileNameParser("message").parse(); | ||
assertEquals("message", filename.domain()); | ||
assertNull(filename.language()); | ||
assertNull(filename.region()); | ||
} | ||
|
||
@Test | ||
void test_domain_en() { | ||
Filename filename = new ResourcesFileNameParser("message_en").parse(); | ||
assertEquals("message", filename.domain()); | ||
assertEquals("en", filename.language()); | ||
assertNull(filename.region()); | ||
assertEquals("en", filename.locale().toString()); | ||
} | ||
|
||
@Test | ||
void test_domain_en_withDash() { | ||
Filename filename = new ResourcesFileNameParser("message-en").parse(); | ||
assertEquals("message", filename.domain()); | ||
assertEquals("en", filename.language()); | ||
assertNull(filename.region()); | ||
assertEquals("en", filename.locale().toString()); | ||
} | ||
|
||
@Test | ||
void test_domain_enGB() { | ||
Filename filename = new ResourcesFileNameParser("message_en_GB").parse(); | ||
assertEquals("message", filename.domain()); | ||
assertEquals("en", filename.language()); | ||
assertEquals("GB", filename.region()); | ||
assertEquals("en_GB", filename.locale().toString()); | ||
} | ||
|
||
@Test | ||
void test_domain_enGB_withDash() { | ||
Filename filename = new ResourcesFileNameParser("message-en-GB").parse(); | ||
assertEquals("message", filename.domain()); | ||
assertEquals("en", filename.language()); | ||
assertEquals("GB", filename.region()); | ||
assertEquals("en_GB", filename.locale().toString()); | ||
} | ||
|
||
@Test | ||
void test_hasNoLocale() { | ||
Filename filename = new ResourcesFileNameParser("message").parse(); | ||
assertFalse(filename.hasLocale()); | ||
} | ||
|
||
@Test | ||
void test_hasLocale() { | ||
Filename filename = new ResourcesFileNameParser("message_de").parse(); | ||
assertTrue(filename.hasLocale()); | ||
} | ||
} |
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