@Test
public void addMapserver() throws Exception {

    MapServer mapServerToAdd = new MapServer();
    mapServerToAdd.setName("mapserver-toadd");
    mapServerToAdd.setConfigurl("http://mapserver-toadd/rest");
    mapServerToAdd.setDescription("A test mapserver");
    mapServerToAdd.setWmsurl("http://mapserver-toadd/wms");
    Gson gson = new GsonBuilder()
        .setFieldNamingStrategy(new JsonFieldNamingStrategy())
        .setExclusionStrategies(new FieldNameExclusionStrategy("_pushstyleinworkspace"))
        .create();
    String json = gson.toJson(mapServerToAdd);
    this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build();
    this.mockHttpSession = loginAsAdmin();
    this.mockMvc.perform(put("/srv/api/mapservers")
        .content(json)
        .contentType(API_JSON_EXPECTED_ENCODING)
        .session(this.mockHttpSession)
        .accept(MediaType.parseMediaType("application/json")))
        .andExpect(status().is(201));
}