1 package org.geojson.jackson; 2 3 import com.fasterxml.jackson.databind.ObjectMapper; 4 import org.geojson.LngLatAlt; 5 import org.geojson.MultiLineString; 6 import org.junit.Test; 7 8 import java.util.Arrays; 9 10 import static org.junit.Assert.assertEquals; 11 12 public class MultiLineStringTest { 13 14 private ObjectMapper mapper = new ObjectMapper(); 15 16 @Test itShouldSerialize()17 public void itShouldSerialize() throws Exception { 18 MultiLineString multiLineString = new MultiLineString(); 19 multiLineString.add(Arrays.asList(new LngLatAlt(100, 0), new LngLatAlt(101, 1))); 20 multiLineString.add(Arrays.asList(new LngLatAlt(102, 2), new LngLatAlt(103, 3))); 21 assertEquals("{\"type\":\"MultiLineString\",\"coordinates\":" 22 + "[[[100.0,0.0],[101.0,1.0]],[[102.0,2.0],[103.0,3.0]]]}", mapper.writeValueAsString(multiLineString)); 23 } 24 } 25