A small module builds the list of products for the storefront. After a recent PR, the order of items and the contents of the top part of the list no longer match the storefront rules.
You need to review the changes and find defects in the result-preparation logic.
buildFrontPage method must:
available == true;rank;rank is the same, sort products by title in alphabetical order, case-insensitive;limit elements.title.CatalogService API.CatalogService.buildFrontPage on the following dataset:val items = List(
CatalogItem("p1", "beta", rank = 2, available = true),
CatalogItem("p2", "Alpha", rank = 1, available = true),
CatalogItem("p3", "gamma", rank = 1, available = false),
CatalogItem("p4", "apple", rank = 1, available = true),
CatalogItem("p5", "Delta", rank = 3, available = true)
)
limit = 3.p2, p4, p1.limit positions.3.3.121title comparison is performed using String.toLowerCase(java.util.Locale.ROOT)Use line comments to explain the problem, its impact, the fix and how to test it.