-
Notifications
You must be signed in to change notification settings - Fork 479
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): VariableRenderer should expose alternativeRender
- Loading branch information
1 parent
2211539
commit 00172f1
Showing
2 changed files
with
65 additions
and
4 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
43 changes: 43 additions & 0 deletions
43
core/src/test/java/io/kestra/core/runners/VariableRendererTest.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,43 @@ | ||
package io.kestra.core.runners; | ||
|
||
import io.kestra.core.exceptions.IllegalVariableEvaluationException; | ||
import io.micronaut.context.ApplicationContext; | ||
import io.micronaut.test.extensions.junit5.annotation.MicronautTest; | ||
import jakarta.inject.Inject; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.Map; | ||
|
||
@MicronautTest | ||
class VariableRendererTest { | ||
|
||
@Inject | ||
ApplicationContext applicationContext; | ||
|
||
@Inject | ||
VariableRenderer.VariableConfiguration variableConfiguration; | ||
|
||
@Test | ||
void shouldRenderUsingAlternativeRendering() throws IllegalVariableEvaluationException { | ||
TestVariableRenderer renderer = new TestVariableRenderer(applicationContext, variableConfiguration); | ||
String render = renderer.render("{{ dummy }}", Map.of()); | ||
Assertions.assertEquals("result", render); | ||
} | ||
|
||
|
||
public static class TestVariableRenderer extends VariableRenderer { | ||
|
||
public TestVariableRenderer(ApplicationContext applicationContext, | ||
VariableConfiguration variableConfiguration) { | ||
super(applicationContext, variableConfiguration); | ||
} | ||
|
||
@Override | ||
protected String alternativeRender(Exception e, String inline, Map<String, Object> variables) throws IllegalVariableEvaluationException { | ||
return "result"; | ||
} | ||
} | ||
|
||
|
||
} |