@Test
public void test_createSafe_successfully() {

    String token = "5PDrOhsy4ig8L3EpsJZSLAMg";
    SafeBasicDetails safeBasicDetails = new SafeBasicDetails("mysafe01", "youremail@yourcompany.com", null, "My first safe");
    Safe safe = new Safe("shared/mysafe01",safeBasicDetails);
    String jsonStr = "{ \"data\": {\"description\": \"My first safe\", \"name\": \"mysafe01\", \"owner\": \"youremail@yourcompany.com\"}, \"path\": \"shared/mysafe01\"}";
    String metadatajson = "{\"path\":\"metadata/shared/mysafe03\",\"data\":{\"name\":\"mysafe03\",\"owner\":\"youremail@yourcompany.com\",\"type\":\"\",\"description\":\"My first safe\"}}";
    Response responseNoContent = getMockResponse(HttpStatus.NO_CONTENT, true, "");
    ResponseEntity<String> responseEntityExpected = ResponseEntity.status(HttpStatus.OK).body("{\"messages\":[\"Safe and associated read/write/deny policies created \"]}");
    Map<String,Object> reqparams = null;
    try {
        reqparams = new ObjectMapper().readValue(jsonStr, new TypeReference<Map<String, Object>>(){});
    } catch (IOException e) {
        e.printStackTrace();
    }
    when(ControllerUtil.converSDBInputsToLowerCase(JSONUtil.getJSON(safe))).thenReturn(jsonStr);
    when(ControllerUtil.parseJson(jsonStr)).thenReturn(reqparams);
    when(ControllerUtil.areSDBInputsValid(safe)).thenReturn(true);
    when(JSONUtil.getJSON(safe)).thenReturn(jsonStr);
    when(ControllerUtil.isValidSafePath(any())).thenReturn(true);
    when(reqProcessor.process("/sdb/create",jsonStr,token)).thenReturn(responseNoContent);
    when(ControllerUtil.convetToJson(any())).thenReturn(metadatajson);
    when(reqProcessor.process("/write",metadatajson,token)).thenReturn(responseNoContent);
    when(reqProcessor.process(eq("/access/update"),any(),eq(token))).thenReturn(responseNoContent);
    ResponseEntity<String> responseEntity = safesService.createSafe(token, safe);
    assertEquals(HttpStatus.OK, responseEntity.getStatusCode());
    assertEquals(responseEntityExpected, responseEntity);
}