• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package org.geojson;
2 
3 import com.fasterxml.jackson.databind.ObjectMapper;
4 import org.junit.Test;
5 
6 import static org.junit.Assert.assertEquals;
7 import static org.junit.Assert.assertNotNull;
8 
9 public class FeatureTest {
10 
11 	private Feature testObject = new Feature();
12 	private ObjectMapper mapper = new ObjectMapper();
13 
14 	@Test
itShouldHaveProperties()15 	public void itShouldHaveProperties() throws Exception {
16 		assertNotNull(testObject.getProperties());
17 	}
18 
19 	@Test
itShouldSerializeFeature()20 	public void itShouldSerializeFeature() throws Exception {
21 		// http://geojson.org/geojson-spec.html#feature-objects
22 		// A feature object must have a member with the name "properties".
23 		// The value of the properties member is an object (any JSON object or a JSON null value).
24 		assertEquals("{\"type\":\"Feature\",\"properties\":{},\"geometry\":null}",
25 				mapper.writeValueAsString(testObject));
26 	}
27 }