@Test
public void getIndexMappings() throws IOException {

  URL url = Resources.getResource(TEST_MAPPING_FILE);
  String mappings = Resources.toString(url, Charsets.UTF_8);
  String indexName = "test";
  ElasticsearchNodeClient client = mockClient(indexName, mappings);
  Map<String, IndexMapping> indexMappings = client.getIndexMappings(indexName);
  assertEquals(1, indexMappings.size());
  IndexMapping indexMapping = indexMappings.values().iterator().next();
  assertEquals(20, indexMapping.size());
  assertEquals("text", indexMapping.getFieldType("address"));
  assertEquals("integer", indexMapping.getFieldType("age"));
  assertEquals("double", indexMapping.getFieldType("balance"));
  assertEquals("keyword", indexMapping.getFieldType("city"));
  assertEquals("date", indexMapping.getFieldType("birthday"));
  assertEquals("geo_point", indexMapping.getFieldType("location"));
  assertEquals("some_new_es_type_outside_type_system", indexMapping.getFieldType("new_field"));
  assertEquals("text", indexMapping.getFieldType("field with spaces"));
  assertEquals("text_keyword", indexMapping.getFieldType("employer"));
  assertEquals("keyword", indexMapping.getFieldType("employer.raw"));
  assertEquals("nested", indexMapping.getFieldType("projects"));
  assertEquals("boolean", indexMapping.getFieldType("projects.active"));
  assertEquals("date", indexMapping.getFieldType("projects.release"));
  assertEquals("nested", indexMapping.getFieldType("projects.members"));
  assertEquals("text", indexMapping.getFieldType("projects.members.name"));
  assertEquals("object", indexMapping.getFieldType("manager"));
  assertEquals("text_keyword", indexMapping.getFieldType("manager.name"));
  assertEquals("keyword", indexMapping.getFieldType("manager.name.keyword"));
  assertEquals("keyword", indexMapping.getFieldType("manager.address"));
  assertEquals("long", indexMapping.getFieldType("manager.salary"));
}