As I haven't gotten an answer for my other question here, I am looking for another approach. Is there a way to no not execute or include a fragment during unit testing?
I want to display the version and build number in the footer of my templates, thus I have the following line:
<div class="versionInfo">Version <span th:text="${@buildProperties.getVersion()}"></span></div>
This works well when running the application, but during unit test I get the exception:
No bean named 'buildProperties' available
In the other question I am looking for a way to get this bean during unit test, as an alternative I am now looking for a way to exclude this template during unit tests. Something like this:
<div class="versionInfo" th:if="${!isUnitTest}">Version <span th:text="${@buildProperties.getVersion()}"></span></div>
I am using the following annotations on my test class:
@RunWith(SpringRunner.class)
@WebMvcTest(SimpleController.class)