diff --git a/dapr-spring/dapr-spring-boot-autoconfigure/src/test/java/io/dapr/spring/boot/autoconfigure/client/DaprClientPropertiesTest.java b/dapr-spring/dapr-spring-boot-autoconfigure/src/test/java/io/dapr/spring/boot/autoconfigure/client/DaprClientPropertiesTest.java index 219e59bf4..85bd605a7 100644 --- a/dapr-spring/dapr-spring-boot-autoconfigure/src/test/java/io/dapr/spring/boot/autoconfigure/client/DaprClientPropertiesTest.java +++ b/dapr-spring/dapr-spring-boot-autoconfigure/src/test/java/io/dapr/spring/boot/autoconfigure/client/DaprClientPropertiesTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Dapr Authors + * Copyright 2025 The Dapr Authors * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -14,8 +14,9 @@ limitations under the License. package io.dapr.spring.boot.autoconfigure.client; import org.assertj.core.api.SoftAssertions; -import org.junit.Test; + import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.test.context.runner.ApplicationContextRunner; @@ -33,11 +34,11 @@ public class DaprClientPropertiesTest { "http://localhost", "localhost", 3500, 50001 ); - SoftAssertions.assertSoftly(softAssertions -> { - softAssertions.assertThat(properties.getGrpcEndpoint()).isEqualTo("localhost"); - softAssertions.assertThat(properties.getHttpEndpoint()).isEqualTo("http://localhost"); - softAssertions.assertThat(properties.getHttpPort()).isEqualTo(3500); - softAssertions.assertThat(properties.getGrpcPort()).isEqualTo(50001); + SoftAssertions.assertSoftly(softly -> { + softly.assertThat(properties.getGrpcEndpoint()).isEqualTo("localhost"); + softly.assertThat(properties.getHttpEndpoint()).isEqualTo("http://localhost"); + softly.assertThat(properties.getHttpPort()).isEqualTo(3500); + softly.assertThat(properties.getGrpcPort()).isEqualTo(50001); }); } @@ -71,11 +72,11 @@ public class DaprClientPropertiesTest { "dapr.client.grpc-port=50001" ).run(context -> { DaprClientProperties properties = context.getBean(DaprClientProperties.class); - SoftAssertions.assertSoftly(softAssertions -> { - softAssertions.assertThat(properties.getGrpcEndpoint()).isEqualTo("localhost"); - softAssertions.assertThat(properties.getHttpEndpoint()).isEqualTo("http://localhost"); - softAssertions.assertThat(properties.getHttpPort()).isEqualTo(3500); - softAssertions.assertThat(properties.getGrpcPort()).isEqualTo(50001); + SoftAssertions.assertSoftly(softly -> { + softly.assertThat(properties.getGrpcEndpoint()).isEqualTo("localhost"); + softly.assertThat(properties.getHttpEndpoint()).isEqualTo("http://localhost"); + softly.assertThat(properties.getHttpPort()).isEqualTo(3500); + softly.assertThat(properties.getGrpcPort()).isEqualTo(50001); }); }); diff --git a/dapr-spring/dapr-spring-boot-autoconfigure/src/test/java/io/dapr/spring/boot/autoconfigure/pubsub/DaprPubSubPropertiesTest.java b/dapr-spring/dapr-spring-boot-autoconfigure/src/test/java/io/dapr/spring/boot/autoconfigure/pubsub/DaprPubSubPropertiesTest.java new file mode 100644 index 000000000..ab02166d7 --- /dev/null +++ b/dapr-spring/dapr-spring-boot-autoconfigure/src/test/java/io/dapr/spring/boot/autoconfigure/pubsub/DaprPubSubPropertiesTest.java @@ -0,0 +1,60 @@ +/* + * Copyright 2025 The Dapr Authors + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and +limitations under the License. +*/ + +package io.dapr.spring.boot.autoconfigure.pubsub; + +import org.assertj.core.api.SoftAssertions; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.boot.test.context.runner.ApplicationContextRunner; + +public class DaprPubSubPropertiesTest { + + final ApplicationContextRunner runner = new ApplicationContextRunner() + .withUserConfiguration(EnableDaprPubSubProperties.class); + + + @Test + @DisplayName("Should configure properties with setters") + void shouldSetProperties() { + DaprPubSubProperties properties = new DaprPubSubProperties(); + properties.setName("pubsub"); + properties.setObservationEnabled(false); + + SoftAssertions.assertSoftly(softAssertions -> { + softAssertions.assertThat(properties.getName()).isEqualTo("pubsub"); + softAssertions.assertThat(properties.isObservationEnabled()).isEqualTo(false); + }); + } + + @Test + @DisplayName("Should map DaprPubSubProperties correctly") + void shouldMapDaprPubSubPropertiesCorrectly() { + runner.withPropertyValues( + "dapr.pubsub.name=pubsub", + "dapr.pubsub.observation-enabled=true" + ).run(context -> { + DaprPubSubProperties properties = context.getBean(DaprPubSubProperties.class); + + SoftAssertions.assertSoftly(softAssertions -> { + softAssertions.assertThat(properties.getName()).isEqualTo("pubsub"); + softAssertions.assertThat(properties.isObservationEnabled()).isEqualTo(true); + }); + }); + } + + @EnableConfigurationProperties(DaprPubSubProperties.class) + static class EnableDaprPubSubProperties { + } +} diff --git a/dapr-spring/dapr-spring-boot-autoconfigure/src/test/java/io/dapr/spring/boot/autoconfigure/statestore/DaprStateStorePropertiesTest.java b/dapr-spring/dapr-spring-boot-autoconfigure/src/test/java/io/dapr/spring/boot/autoconfigure/statestore/DaprStateStorePropertiesTest.java new file mode 100644 index 000000000..8084300c1 --- /dev/null +++ b/dapr-spring/dapr-spring-boot-autoconfigure/src/test/java/io/dapr/spring/boot/autoconfigure/statestore/DaprStateStorePropertiesTest.java @@ -0,0 +1,63 @@ +/* + * Copyright 2021 The Dapr Authors + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and +limitations under the License. +*/ + +package io.dapr.spring.boot.autoconfigure.statestore; + +import org.assertj.core.api.SoftAssertions; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.boot.test.context.runner.ApplicationContextRunner; + +public class DaprStateStorePropertiesTest { + + + final ApplicationContextRunner runner = new ApplicationContextRunner() + .withUserConfiguration(EnableDaprStateStoreProperties.class); + + @Test + @DisplayName("Should create DaprStateStoreProperties via constructor") + void shouldSetDaprStateStorePropertiesCorrectly() { + DaprStateStoreProperties properties = new DaprStateStoreProperties(); + properties.setBinding("binding"); + properties.setName("name"); + + SoftAssertions.assertSoftly(softAssertions -> { + softAssertions.assertThat(properties.getName()).isEqualTo("name"); + softAssertions.assertThat(properties.getBinding()).isEqualTo("binding"); + }); + } + + @Test + @DisplayName("Should map Dapr state store properties correctly") + void shouldMapDaprStateStoreProperties() { + runner.withPropertyValues( + "dapr.statestore.name=name", + "dapr.statestore.binding=binding" + ).run(context -> { + DaprStateStoreProperties properties = context.getBean(DaprStateStoreProperties.class); + + SoftAssertions.assertSoftly(softly -> { + softly.assertThat(properties.getBinding()).isEqualTo("binding"); + softly.assertThat(properties.getName()).isEqualTo("name"); + }); + }); + + } + + @EnableConfigurationProperties(DaprStateStoreProperties.class) + static class EnableDaprStateStoreProperties { + + } + +} diff --git a/pom.xml b/pom.xml index 45344dac6..2be2a6ab2 100644 --- a/pom.xml +++ b/pom.xml @@ -50,6 +50,7 @@ 1.20.5 3.4.3 1.7.0 + 3.27.3 diff --git a/sdk/pom.xml b/sdk/pom.xml index 0f8563f22..cea518bcb 100644 --- a/sdk/pom.xml +++ b/sdk/pom.xml @@ -127,6 +127,11 @@ ${jackson.version} test + + org.assertj + assertj-core + ${assertj.version} + diff --git a/sdk/src/test/java/io/dapr/client/domain/BulkPublishEntryTest.java b/sdk/src/test/java/io/dapr/client/domain/BulkPublishEntryTest.java new file mode 100644 index 000000000..e02764ba8 --- /dev/null +++ b/sdk/src/test/java/io/dapr/client/domain/BulkPublishEntryTest.java @@ -0,0 +1,44 @@ +/* + * Copyright 2025 The Dapr Authors + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and +limitations under the License. +*/ +package io.dapr.client.domain; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; + +import java.util.Map; + +import static org.assertj.core.api.Assertions.assertThat; + +class BulkPublishEntryTest { + + @Test + @DisplayName("Should create an empty metadata when metadata argument is null") + public void shouldCreateWithEmptyMetadataWhenMetadataIsNull() { + BulkPublishEntry entry = new BulkPublishEntry<>( + "entryId", "event", "contentType", null + ); + assertThat(entry.getMetadata()).isEmpty(); + } + + @Test + @DisplayName("Should create with non null metadata") + public void shouldCreateWithMetadata() { + BulkPublishEntry entry = new BulkPublishEntry<>( + "entryId", "event", "application/json", Map.of( + "repo", "dapr/java-sdk" + )); + assertThat(entry.getMetadata()).hasSize(1); + } + +} diff --git a/sdk/src/test/java/io/dapr/client/domain/BulkPublishRequestTest.java b/sdk/src/test/java/io/dapr/client/domain/BulkPublishRequestTest.java index 5211cec48..f633428a9 100644 --- a/sdk/src/test/java/io/dapr/client/domain/BulkPublishRequestTest.java +++ b/sdk/src/test/java/io/dapr/client/domain/BulkPublishRequestTest.java @@ -10,16 +10,17 @@ * See the License for the specific language governing permissions and limitations under the License. */ - package io.dapr.client.domain; -import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import java.util.Collections; import java.util.HashMap; +import java.util.List; import java.util.Map; +import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertNull; public class BulkPublishRequestTest { @@ -36,6 +37,15 @@ public class BulkPublishRequestTest { request.setMetadata(metadata); Map initial = request.getMetadata(); request.setMetadata(metadata); - Assertions.assertNotSame( request.getMetadata(), initial, "Should not be same map"); + + assertThat(request.getMetadata()).isNotSameAs(initial); + } + + @Test + @DisplayName("Should create a BulkPublishRequest with empty list when entries is null") + public void shouldCreateWithEmptyListWhenEntriesIsNull() { + BulkPublishRequest request = new BulkPublishRequest<>("testPubsub", "testTopic", null); + List> entries = request.getEntries(); + assertThat(entries).isNotNull(); } } diff --git a/sdk/src/test/java/io/dapr/client/domain/ConfigurationItemTest.java b/sdk/src/test/java/io/dapr/client/domain/ConfigurationItemTest.java new file mode 100644 index 000000000..e37af91a5 --- /dev/null +++ b/sdk/src/test/java/io/dapr/client/domain/ConfigurationItemTest.java @@ -0,0 +1,50 @@ +/* + * Copyright 2025 The Dapr Authors + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and +limitations under the License. +*/ +package io.dapr.client.domain; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; + +import java.util.Map; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +class ConfigurationItemTest { + + @Test + @DisplayName("Should create ConfigurationItem correctly") + void shouldCreateConfigurationItemCorrectly() { + ConfigurationItem item = new ConfigurationItem("application", "java-sdk", "0.0.1", Map.of( + "creator", "devs" + )); + + assertThat(item.getKey()).isEqualTo("application"); + assertThat(item.getValue()).isEqualTo("java-sdk"); + assertThat(item.getVersion()).isEqualTo("0.0.1"); + assertThat(item.getMetadata()).hasSize(1); + assertThat(item.getMetadata()).hasEntrySatisfying("creator", value -> { + assertThat(value).isEqualTo("devs"); + }); + } + + @Test + @DisplayName("Should create with immutable metadata") + void shouldCreateWithImmutableMetadata() { + ConfigurationItem item = new ConfigurationItem("application", "java-sdk", "0.0.1", Map.of( + "creator", "devs" + )); + assertThatThrownBy(() -> item.getMetadata().put("language", "javascript")); + } +} diff --git a/sdk/src/test/java/io/dapr/client/domain/HttpExtensionTest.java b/sdk/src/test/java/io/dapr/client/domain/HttpExtensionTest.java new file mode 100644 index 000000000..717ef7206 --- /dev/null +++ b/sdk/src/test/java/io/dapr/client/domain/HttpExtensionTest.java @@ -0,0 +1,60 @@ +/* + * Copyright 2025 The Dapr Authors + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and +limitations under the License. +*/ + +package io.dapr.client.domain; + +import io.dapr.client.DaprHttp; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; + +import java.util.List; +import java.util.Map; + +class HttpExtensionTest { + + + @Test + @DisplayName("Should encode query params correctly") + void shouldEncodeQueryParamsCorrectly() { + HttpExtension httpExtension = new HttpExtension(DaprHttp.HttpMethods.GET, + Map.of("traceparent", List.of("00-4bf92f3577b34da6a3ce929d0e0e4733-00f067aa0ba902b7-01")), Map.of()); + + String encoded = httpExtension.encodeQueryString(); + + Assertions.assertEquals("traceparent=00-4bf92f3577b34da6a3ce929d0e0e4733-00f067aa0ba902b7-01", encoded); + } + + @Test + @DisplayName("Should encode multiple values for same query param key") + void shouldEncodeMultipleValuesForSameQueryParamKey() { + HttpExtension httpExtension = new HttpExtension(DaprHttp.HttpMethods.GET, + Map.of("category", List.of("books", "electronics")), Map.of()); + + String encoded = httpExtension.encodeQueryString(); + + Assertions.assertEquals("category=books&category=electronics", encoded); + } + + @Test + @DisplayName("Should encode query param with spaces, accents, and special characters") + void shouldEncodeQueryParamWithSpacesAndSpecialCharacters() { + HttpExtension httpExtension = new HttpExtension(DaprHttp.HttpMethods.GET, + Map.of("user name", List.of("John Doƫ & Co.")), Map.of()); + + String encoded = httpExtension.encodeQueryString(); + + Assertions.assertEquals("user+name=John+Do%C3%AB+%26+Co.", encoded); + } + +} diff --git a/sdk/src/test/java/io/dapr/client/domain/SaveStateRequestTest.java b/sdk/src/test/java/io/dapr/client/domain/SaveStateRequestTest.java index 09889bd54..8bc2efa84 100644 --- a/sdk/src/test/java/io/dapr/client/domain/SaveStateRequestTest.java +++ b/sdk/src/test/java/io/dapr/client/domain/SaveStateRequestTest.java @@ -1,10 +1,24 @@ +/* + * Copyright 2025 The Dapr Authors + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and +limitations under the License. +*/ package io.dapr.client.domain; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import java.util.ArrayList; import java.util.List; +import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotSame; import static org.junit.jupiter.api.Assertions.assertNull; @@ -31,4 +45,15 @@ public class SaveStateRequestTest { assertEquals("test var args 1", request.getStates().get(0).getKey(), "Value incorrectly set"); assertEquals("test var args 2", request.getStates().get(1).getKey(), "Value incorrectly set"); } -} \ No newline at end of file + + @Test + @DisplayName("Should set states as null when the argument is null") + void testSetStateWithNullParameter() { + + SaveStateRequest request = new SaveStateRequest(STORE_NAME); + request.setStates((List>) null); + List> states = request.getStates(); + + assertThat(states).isNull(); + } +} diff --git a/sdk/src/test/java/io/dapr/client/domain/StateTest.java b/sdk/src/test/java/io/dapr/client/domain/StateTest.java index 30870d9cd..9f9d6af7a 100644 --- a/sdk/src/test/java/io/dapr/client/domain/StateTest.java +++ b/sdk/src/test/java/io/dapr/client/domain/StateTest.java @@ -1,10 +1,12 @@ package io.dapr.client.domain; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import java.util.HashMap; import java.util.Map; +import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -106,4 +108,16 @@ public class StateTest { assertNotEquals(state1.hashCode(), state4.hashCode()); assertNotEquals(state1, state4); } + + @Test + @DisplayName("Should hashCode and equals method work with null metadata") + public void testEqualsAndHashcodeWithNullValues() { + State state1 = new State<>(KEY, "value", ETAG, null, OPTIONS); + State state2 = new State<>(KEY, "value", ETAG, null, OPTIONS); + + assertThat(state1.toString()).isEqualTo(state2.toString()); + assertThat(state1.hashCode()).isEqualTo(state1.hashCode()); + assertThat(state1).isEqualTo(state2); + } + } diff --git a/sdk/src/test/java/io/dapr/client/domain/TransactionalStateRequestTest.java b/sdk/src/test/java/io/dapr/client/domain/TransactionalStateRequestTest.java new file mode 100644 index 000000000..af2a6597c --- /dev/null +++ b/sdk/src/test/java/io/dapr/client/domain/TransactionalStateRequestTest.java @@ -0,0 +1,63 @@ +/* + * Copyright 2025 The Dapr Authors + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and +limitations under the License. +*/ +package io.dapr.client.domain; + +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; + +import java.util.List; +import java.util.Map; + +import static org.assertj.core.api.Assertions.assertThat; + +class TransactionalStateRequestTest { + + + @Test + @DisplayName("Should create with non empty collections") + void shouldCreateCorrectlyWithNonEmptyCollections() { + + State users = new State<>("users"); + TransactionalStateOperation operation = + new TransactionalStateOperation<>(TransactionalStateOperation.OperationType.DELETE, users); + + TransactionalStateRequest request = new TransactionalStateRequest<>( + List.of(operation), Map.of("application", "java-sdk") + ); + + assertThat(request.getMetadata()).hasSize(1); + assertThat(request.getOperations()).hasSize(1); + } + + @Test + @DisplayName("Should create correctly with empty collections") + void shouldCreateCorrectlyWithEmptyCollections() { + TransactionalStateRequest request = new TransactionalStateRequest<>( + List.of(), Map.of() + ); + assertThat(request.getMetadata()).isEmpty(); + assertThat(request.getOperations()).isEmpty(); + } + + @Test + @DisplayName("Should create correctly with null value") + void shouldCreateWhenArgumentIsNull() { + TransactionalStateRequest request = new TransactionalStateRequest<>( + null, null + ); + assertThat(request.getMetadata()).isNull(); + assertThat(request.getOperations()).isNull(); + } + + +} diff --git a/sdk/src/test/java/io/dapr/config/IntegerPropertyTest.java b/sdk/src/test/java/io/dapr/config/IntegerPropertyTest.java new file mode 100644 index 000000000..2ea65d37c --- /dev/null +++ b/sdk/src/test/java/io/dapr/config/IntegerPropertyTest.java @@ -0,0 +1,39 @@ +/* + * Copyright 2025 The Dapr Authors + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and +limitations under the License. +*/ +package io.dapr.config; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +public class IntegerPropertyTest { + + @Test + @DisplayName("Should create IntegerProperty correctly") + void shouldCreateIntegerPropertyCorrectly() { + IntegerProperty property = new IntegerProperty("int", "INT", 0); + Integer twoHundreds = property.parse("200"); + assertThat(twoHundreds).isEqualTo(200); + } + + @Test + @DisplayName("Should throws NumberFormatException when parsing non number") + void shouldThrowsExceptionWhenParsingNonNumber() { + IntegerProperty property = new IntegerProperty("int", "INT", 0); + assertThatThrownBy(() -> property.parse("TWO_THOUSANDS")); + } + +}