Skip to content

Commit bb3ac99

Browse files
committed
Merged with main
1 parent 0de4c60 commit bb3ac99

File tree

1 file changed

+29
-17
lines changed

1 file changed

+29
-17
lines changed

components/sbm-recipes-boot-upgrade/src/test/java/org/springframework/sbm/boot/upgrade_27_30/report/SpringBootUpgradeReportTestSupport.java

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -195,23 +195,35 @@ private void verify(Consumer<String> assertion) {
195195
* code of buttons to apply a recipe.
196196
*/
197197
private String replaceRe4cipeButtonCodeFromExpectedOutput(SpringBootUpgradeReportSection sectionUnderTest, String renderedSection) {
198-
String recipe = sectionUnderTest.getRecipe();
199-
String target = """
200-
201-
++++
202-
<form name="recipe-1" action="http://localhost:8080/spring-boot-upgrade" method="post">
203-
<input type="hidden" name="recipeName" value="<RECIPE>" />
204-
<button name="<RECIPE>" type="submit" style="background-color:#71ea5b;border:width: 120px;
205-
text-align: center;
206-
font-size: 15px;
207-
padding: 20px;
208-
border-radius: 15px;">Run Recipe</button>
209-
</form>
210-
++++
211-
212-
""";
213-
String buttonCode = target.replace("<RECIPE>", recipe);
214-
return renderedSection.replace(buttonCode, "");
198+
StringBuilder sb = new StringBuilder();
199+
List<String> buttonCodes = sectionUnderTest
200+
.getRemediation()
201+
.getPossibilities()
202+
.stream()
203+
.filter(p -> p.getRecipe() != null)
204+
.map(RemediationPossibility::getRecipe)
205+
.map(recipe -> {
206+
String target = """
207+
208+
++++
209+
<form name="recipe-1" action="http://localhost:8080/spring-boot-upgrade" method="post">
210+
<input type="hidden" name="recipeName" value="<RECIPE>" />
211+
<button name="<RECIPE>" type="submit" style="background-color:#71ea5b;border:width: 120px;
212+
text-align: center;
213+
font-size: 15px;
214+
padding: 20px;
215+
border-radius: 15px;">Run Recipe</button>
216+
</form>
217+
++++
218+
219+
""";
220+
return target.replace("<RECIPE>", recipe);
221+
})
222+
.collect(Collectors.toList());
223+
for(String buttonCode : buttonCodes) {
224+
renderedSection = renderedSection.replace(buttonCode, "");
225+
}
226+
return renderedSection;
215227
}
216228

217229
private void withRecipes(Consumer<Recipes> recipesConsumer) {

0 commit comments

Comments
 (0)