@Test
public void putTag() throws Exception {

    MetadataCategory category = _categoriesRepo.findOneByName("newcategory");
    Assert.assertNull(category);
    MetadataCategory newCategory = new MetadataCategory();
    newCategory.setId(-99);
    newCategory.setName("newcategory");
    Gson gson = new GsonBuilder()
        .setFieldNamingStrategy(new JsonFieldNamingStrategy())
        .setExclusionStrategies(new FieldNameExclusionStrategy("_labelTranslations", "_records"))
        .create();
    String json = gson.toJson(newCategory);
    this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build();
    this.mockHttpSession = loginAsAdmin();
    this.mockMvc.perform(put("/srv/api/tags")
        .content(json)
        .contentType(API_JSON_EXPECTED_ENCODING)
        .session(this.mockHttpSession)
        .accept(MediaType.parseMediaType("application/json")))
        .andExpect(status().is(204));
    MetadataCategory categoryCreated = _categoriesRepo.findOneByName(newCategory.getName());
    Assert.assertNotNull(categoryCreated);
}