|
14 | 14 |
|
15 | 15 | import com.fasterxml.jackson.databind.ObjectMapper; |
16 | 16 | import io.fabric8.kubernetes.api.model.Namespace; |
17 | | -import io.fabric8.kubernetes.api.model.ObjectMeta; |
| 17 | +import io.fabric8.kubernetes.api.model.NamespaceBuilder; |
18 | 18 | import io.fabric8.kubernetes.api.model.Pod; |
19 | 19 | import org.apache.logging.log4j.core.lookup.StrLookup; |
20 | 20 | import org.junit.jupiter.api.Test; |
21 | 21 |
|
22 | 22 | import java.net.URL; |
23 | | -import java.util.HashMap; |
24 | | -import java.util.Map; |
25 | 23 |
|
26 | 24 | import static org.assertj.core.api.Assertions.assertThat; |
27 | 25 |
|
@@ -101,16 +99,11 @@ private void assertNamespaceLookups(final StrLookup lookup) { |
101 | 99 | } |
102 | 100 |
|
103 | 101 | private Namespace createNamespace() { |
104 | | - final Namespace namespace = new Namespace(); |
105 | | - final ObjectMeta meta = new ObjectMeta(); |
106 | | - final Map<String, String> annotations = new HashMap<>(); |
107 | | - annotations.put("test", "name"); |
108 | | - meta.setAnnotations(annotations); |
109 | | - final Map<String, String> labels = new HashMap<>(); |
110 | | - labels.put("ns", "my-namespace"); |
111 | | - meta.setLabels(labels); |
112 | | - meta.setUid("878f1143-df6d-47eb-81e4-d576597fca24"); |
113 | | - namespace.setMetadata(meta); |
114 | | - return namespace; |
| 102 | + return new NamespaceBuilder().editMetadata() |
| 103 | + .addToAnnotations("test", "name") |
| 104 | + .addToLabels("ns", "my-namespace") |
| 105 | + .withUid("878f1143-df6d-47eb-81e4-d576597fca24") |
| 106 | + .endMetadata() |
| 107 | + .build(); |
115 | 108 | } |
116 | 109 | } |
0 commit comments