|
| 1 | +/* |
| 2 | + * Copyright 2025 The Dapr Authors |
| 3 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | + * you may not use this file except in compliance with the License. |
| 5 | + * You may obtain a copy of the License at |
| 6 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | + * Unless required by applicable law or agreed to in writing, software |
| 8 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 9 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 10 | + * See the License for the specific language governing permissions and |
| 11 | +limitations under the License. |
| 12 | +*/ |
| 13 | +package io.dapr.client.domain; |
| 14 | + |
| 15 | +import org.junit.jupiter.api.Assertions; |
| 16 | +import org.junit.jupiter.api.DisplayName; |
| 17 | +import org.junit.jupiter.api.Test; |
| 18 | + |
| 19 | +import java.util.Map; |
| 20 | + |
| 21 | +class ConfigurationItemTest { |
| 22 | + |
| 23 | + @Test |
| 24 | + @DisplayName("Should create ConfiguratiotruenItem correctly") |
| 25 | + void shouldCreateConfigurationItemCorrectly() { |
| 26 | + ConfigurationItem item = new ConfigurationItem("application", "java-sdk", "0.0.1", Map.of( |
| 27 | + "creator", "devs" |
| 28 | + )); |
| 29 | + |
| 30 | + Assertions.assertEquals("application", item.getKey()); |
| 31 | + Assertions.assertEquals("java-sdk", item.getValue()); |
| 32 | + Assertions.assertEquals("0.0.1", item.getVersion()); |
| 33 | + Assertions.assertEquals(1, item.getMetadata().size()); |
| 34 | + Assertions.assertEquals("devs", item.getMetadata().get("creator")); |
| 35 | + } |
| 36 | + |
| 37 | + @Test |
| 38 | + @DisplayName("Should create with immutable metadata") |
| 39 | + void shouldCreateWithImmutableMetadata() { |
| 40 | + ConfigurationItem item = new ConfigurationItem("application", "java-sdk", "0.0.1", Map.of( |
| 41 | + "creator", "devs" |
| 42 | + )); |
| 43 | + |
| 44 | + Assertions.assertThrows(UnsupportedOperationException.class, () -> { |
| 45 | + item.getMetadata().put("language", "javascript"); |
| 46 | + }); |
| 47 | + } |
| 48 | +} |
0 commit comments