gitgabrio opened a new issue, #1058:
URL: https://github.com/apache/incubator-kie-issues/issues/1058

   Some tests inside kogito-runtimes/codegen actually verify underlying 
validation. e.g. 
[here](https://github.com/apache/incubator-kie-kogito-runtimes/blob/f4821b9f4dcc38e7a2df33fef383ddea4c3cd487/kogito-codegen-modules/kogito-codegen-decisions/src/test/java/org/kie/kogito/codegen/decision/DecisionCodegenTest.java#L60)
   
   ```java
   public void emptyName(KogitoBuildContext.Builder contextBuilder) {
           DecisionCodegen codeGenerator = 
getDecisionCodegen("src/test/resources/decision-empty-name", contextBuilder);
           RuntimeException re = 
Assertions.assertThrows(RuntimeException.class, codeGenerator::generate);
           String expected = "DMN: Invalid name '': Name cannot be null or 
empty (DMN id: _9efe7fc6-f41b-422c-accd-95dcaaa67a39, The listed name is not a 
valid FEEL identifier)";
           assertTrue(re.getMessage().contains(expected));
       }
   ```
   
   The problems of this tests are:
   1. there are multiple of them, so they are basically re-testing the 
validation implementation
   2. they should test only the flow from codegen module to validation, so only 
one should be necessary to check this roundtrip
   3. they, inderectly, point to an implementation flaw, i.e. [kogito 
codegen](https://github.com/apache/incubator-kie-kogito-runtimes/blob/f4821b9f4dcc38e7a2df33fef383ddea4c3cd487/kogito-codegen-modules/kogito-codegen-api/src/main/java/org/kie/kogito/codegen/api/Generator.java#L31)
 exposes only the 
   
   `Collection<GeneratedFile> generate();`
   method; any kind of validation should be made inside it, and then managed 
somehow (e.g.: throwing an exception) that mades hard to implement a proper 
"validation" API
   
   @baldimir @yesamer 
   
   


-- 
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]

Reply via email to