1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.bremersee.geojson.converter.deserialization;
18
19 import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
20 import static org.bremersee.geojson.GeoJsonConstants.GEOMETRY_COLLECTION;
21 import static org.bremersee.geojson.GeoJsonConstants.TYPE;
22
23 import java.util.Map;
24 import org.assertj.core.api.SoftAssertions;
25 import org.assertj.core.api.junit.jupiter.SoftAssertionsExtension;
26 import org.junit.jupiter.api.Test;
27 import org.junit.jupiter.api.extension.ExtendWith;
28 import org.locationtech.jts.geom.Geometry;
29
30
31
32
33
34
35 @ExtendWith(SoftAssertionsExtension.class)
36 class JsonToGeometryConverterTest {
37
38
39
40
41
42
43 @Test
44 void convertAndExpectEmptyGeometry(SoftAssertions softly) {
45 JsonToGeometryConverter target = new JsonToGeometryConverter();
46 Geometry actual = target.convert(Map.of(TYPE, GEOMETRY_COLLECTION));
47
48 softly.assertThat(actual)
49 .isNotNull();
50 softly.assertThat(actual.getCoordinates())
51 .isEmpty();
52 }
53
54
55
56
57 @Test
58 void convertAndExpectIllegalArgumentException() {
59 JsonToGeometryConverter target = new JsonToGeometryConverter();
60 assertThatExceptionOfType(IllegalArgumentException.class)
61 .isThrownBy(() -> target.convert(Map.of("IllegalGeometry", new Object())));
62 }
63 }