--- /dev/null
+<!doctype html>
+<html lang="en" xmlns:th="http://www.thymeleaf.org" th:replace="~{layout :: pagelayout(~{:: title}, ~{:: h1}, ~{:: div.card-text})}">
+ <head>
+ <meta charset="utf-8">
+ <title>Shows Remote-Content</title>
+ </head>
+ <body>
+ <h1>Fetched Data</h1></div>
+ <div class="card-text">
+ <pre th:text="${text}">TEXT</pre>
+ </div>
+ </body>
+</html>
<!doctype html>
-<html xmlns:th="http://www.thymeleaf.org" lang="en">
+<html lang="en" xmlns:th="http://www.thymeleaf.org" th:fragment="pagelayout(title,header,body)">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
- <title>Shows Remote-Content</title>
+ <title th:replace="${title}">TITLE</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
</head>
<body>
<h2 class="navbar-brand">Demo: Unit-Test or Integration-Test — A Practical Guide</h2>
</nav>
<main class="container mt-5">
- <div class="card">
- <div class="card-header" id="content"><h1>Information About Fetched Data</h1></div>
- <div class="card-body">
- <p class="card-text"><pre th:text="${text}">TEXT</pre></p>
- </div>
+ <div id="content" class="card">
+ <div class="card-header"><h1 th:replace="${header}">HEADER</h1></div>
+ <div class="card-body"><div th:replace="${body}">BODY</div></div>
</div>
</main>
</body>
String result = controller.fetch(model, "foo");
- assertThat(result).isEqualTo("layout");
+ assertThat(result).isEqualTo("home");
ArgumentCaptor<Mono<String>> captor = ArgumentCaptor.forClass(Mono.class);
verify(model).addAttribute(eq("text"), captor.capture());
StepVerifier