summaryrefslogtreecommitdiff
path: root/src/test/java/org/zwobble
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/org/zwobble')
-rw-r--r--src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/JavaGeneratorTests.java21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/JavaGeneratorTests.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/JavaGeneratorTests.java
index 9cbd5d9..d7c3eeb 100644
--- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/JavaGeneratorTests.java
+++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/JavaGeneratorTests.java
@@ -28,7 +28,7 @@ public class JavaGeneratorTests {
}
@Test
- public void explicitJavaPackageIsUsedForNamespaceWhenAvailable() {
+ public void explicitJavaPackageIsUsedForNamespaceWhenExactNamespaceHasMapping() {
var config = new JavaGeneratorConfig(
List.of("com", "example"),
Map.ofEntries(
@@ -45,4 +45,23 @@ public class JavaGeneratorTests {
assertThat(result, equalTo(List.of("com", "other")));
}
+
+ @Test
+ public void explicitJavaPackageIsUsedForNamespaceWhenAncestorNamespaceHasMapping() {
+ var config = new JavaGeneratorConfig(
+ List.of("com", "example"),
+ Map.ofEntries(
+ Map.entry(
+ NamespaceName.of("a", "b"),
+ new JavaNamespaceConfig(List.of("com", "other"))
+ )
+ ),
+ Map.of()
+ );
+ var generator = new JavaGenerator(config);
+
+ var result = generator.namespaceToJavaPackageParts(NamespaceName.of("a", "b", "c", "d"));
+
+ assertThat(result, equalTo(List.of("com", "other", "c", "d")));
+ }
}