gitgabrio commented on code in PR #5884:
URL:
https://github.com/apache/incubator-kie-drools/pull/5884#discussion_r1590701403
##########
drools-drl/drools-drl-parser-tests/src/test/java/org/drools/drl/parser/antlr4/MiscDRLParserTest.java:
##########
@@ -4605,4 +4629,46 @@ public void enumDeclaration() {
TypeFieldDescr romanStr =
enumDeclarationDescr.getFields().get("romanStr");
assertThat(romanStr.getPattern().getObjectType()).isEqualTo("String");
}
+
+ @Test
+ void packageChildrenNamespaceAndUnitProperties() {
+ String namespace = "org.drools.compiler.test";
+ String source = readResource("package_children.drl");
+ PackageDescr pkg = parseAndGetPackageDescr(source);
+
+ assertThat(pkg.getName()).isEqualTo(namespace);
+ assertThat(pkg.getUnit().getNamespace()).isEqualTo(namespace);
+
+ Stream<? extends BaseDescr> childrenWithNamespace = Stream.of(
+ pkg.getImports(),
+ pkg.getFunctionImports(),
+ pkg.getAccumulateImports(),
+ pkg.getGlobals(),
+ pkg.getFunctions(),
+ pkg.getRules(),
+ pkg.getAttributes()
+ ).flatMap(Collection::stream);
+
+ assertThat(childrenWithNamespace)
+ .hasSize(9)
Review Comment:
Hi @yurloc
I know this is something common, but this `9`is a migic number without any
description/indication of what it comes from - for readibility improvement it
could be better to declare it as a variable with a meaningful name, or
description: wdyt ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]