@Test
public void testWriteFeatureAsMultiPolygon() throws
                                             Exception {

    // given a Feature as MultiPolygon
    final Feature feature = mock(Feature.class);
    doReturn("id1").when(feature)
                   .getId();
    doReturn("Feature").when(feature)
                       .getType();
    doReturn(createMultiPolygon(gf,
                                createPolygon(gf,
                                              createCoordinate(gf,
                                                               47.226116d,
                                                               -1.554169d),
                                              createCoordinate(gf,
                                                               47.226126d,
                                                               -1.554097d),
                                              createCoordinate(gf,
                                                               47.225527d,
                                                               -1.553986d),
                                              createCoordinate(gf,
                                                               47.225519d,
                                                               -1.554061d),
                                              createCoordinate(gf,
                                                               47.226116d,
                                                               -1.554169d)),
                                createPolygon(gf,
                                              createLinearRing(gf,
                                                               createCoordinate(gf,
                                                                                47.226257d,
                                                                                -1.554564d),
                                                               createCoordinate(gf,
                                                                                47.226295d,
                                                                                -1.554202d),
                                                               createCoordinate(gf,
                                                                                47.226075d,
                                                                                -1.554169d),
                                                               createCoordinate(gf,
                                                                                47.226049d,
                                                                                -1.554496d),
                                                               createCoordinate(gf,
                                                                                47.226257d,
                                                                                -1.554564d)),
                                              createLinearRing(gf,
                                                               createCoordinate(gf,
                                                                                47.226219d,
                                                                                -1.554430d),
                                                               createCoordinate(gf,
                                                                                47.226237d,
                                                                                -1.554261d),
                                                               createCoordinate(gf,
                                                                                47.226122d,
                                                                                -1.554245d),
                                                               createCoordinate(gf,
                                                                                47.226106d,
                                                                                -1.554411d),
                                                               createCoordinate(gf,
                                                                                47.226219d,
                                                                                -1.554430d))))).when(feature)
                                                                                               .getGeometry();
    doReturn(new Bundle()).when(feature)
                          .getProperties();
    // when write this Feature as JSON string
    final StringWriter writer = new StringWriter();
    geoJsonWriter.write(writer,
                        feature);
    // then
    assertNotNull(writer.toString());
    assertEquals(TestHelper.getFixture("feature_multipolygon.json"),
                 writer.toString());
}