View Javadoc
1   /*
2    * Copyright 2022-2026 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.bremersee.geojson.converter;
18  
19  import static org.assertj.core.api.Assertions.assertThat;
20  import static org.mockito.ArgumentMatchers.anyString;
21  import static org.mockito.Mockito.mock;
22  import static org.mockito.Mockito.when;
23  
24  import org.bremersee.geojson.GeoJsonGeometryFactory;
25  import org.junit.jupiter.api.Test;
26  import org.locationtech.jts.geom.MultiLineString;
27  
28  /**
29   * The type String to multi line string converter test.
30   *
31   * @author Christian Bremer
32   */
33  class StringToMultiLineStringConverterTest {
34  
35    /**
36     * Convert.
37     */
38    @Test
39    void convert() {
40      MultiLineString expected = mock(MultiLineString.class);
41      GeoJsonGeometryFactory geometryFactory = mock(GeoJsonGeometryFactory.class);
42      when(geometryFactory.createGeometryFromWellKnownText(anyString()))
43          .thenReturn(expected);
44  
45      StringToMultiLineStringConverter target = new StringToMultiLineStringConverter(
46          geometryFactory);
47      //noinspection unchecked
48      assertThat(target.convert("LEGAL_WKT")).isEqualTo(expected);
49    }
50  }