Commit 464c15e5 authored by Phillip Webb's avatar Phillip Webb

Ensure empty layers are written to the index file

Update the `LayersIndex` class to ensure that layers that do not contain
content are still written.

Closes gh-20858
parent ef9611e3
......@@ -96,8 +96,8 @@ public class LayersIndex {
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out, StandardCharsets.UTF_8));
for (Layer layer : this.layers) {
List<String> names = index.get(layer);
if (names != null && !names.isEmpty()) {
writer.write("- \"" + layer + "\":\n");
writer.write("- \"" + layer + "\":\n");
if (names != null) {
for (String name : names) {
writer.write(" - \"" + name + "\"\n");
}
......
......@@ -75,7 +75,7 @@ class LayersIndexTests {
}
@Test
void writeToWhenLayerNotUsedSkipsLayer() {
void writeToWhenLayerNotUsedDoesNotSkipLayer() {
LayersIndex index = new LayersIndex(LAYER_A, LAYER_B, LAYER_C);
index.add(LAYER_A, "a1");
index.add(LAYER_A, "a2");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment