BAEL-7263: Highlight scenarios where defined variable is evaluated as false

This commit is contained in:
Constantin 2024-02-01 20:06:26 +02:00
parent 003e89f1c6
commit 846d763515
2 changed files with 16 additions and 0 deletions

View File

@ -10,5 +10,10 @@
<div th:if="${serverTime != null}" th:text="'Server Time Using #th:if Conditional Is: ' + ${serverTime}"/>
<div th:unless="${serverTime == null}" th:text="'Server Time Using #th:unless Conditional Is: ' + ${serverTime}"/>
<div th:if='${"false"}' th:text='"Evaluating \"false\"'/>
<div th:if='${"no"}' th:text='"Evaluating \"no\"'/>
<div th:if='${"off"}' th:text='"Evaluating \"off\"'/>
<div th:if="${0}" th:text='"Evaluating 0"'/>
</body>
</html>

View File

@ -74,6 +74,17 @@ public class HomeControllerIntegrationTest {
.andExpect(content().string(not(containsString(IF_CONDITIONAL_MSG))));
}
@Test
public void whenVariableIsDefinedAndNotTrue_thenIfConditionalIsFalse() throws Exception {
mockMvc.perform(MockMvcRequestBuilders.get("/variable-defined"))
.andExpect(status().isOk())
.andExpect(view().name("checkVariableIsDefined.html"))
.andExpect(content().string(not(containsString("Evaluating \"false\""))))
.andExpect(content().string(not(containsString("Evaluating \"no\""))))
.andExpect(content().string(not(containsString("Evaluating \"off\""))))
.andExpect(content().string(not(containsString("Evaluating 0"))));
}
@Test
public void whenVariableIsDefined_thenUnlessConditionalIsTrue() throws Exception {
mockMvc.perform(MockMvcRequestBuilders.get("/variable-defined"))