@Test
public void test_updateSafe_failure_404() {

    String token = "5PDrOhsy4ig8L3EpsJZSLAMg";
    SafeBasicDetails safeBasicDetails = new SafeBasicDetails("mysafe01", "youremail@yourcompany.com", null, "My first safe");
    Safe safe = new Safe("shared/mysafe01",safeBasicDetails);
    String jsonStr = "{\"path\":\"shared/mysafe01\",\"data\":{\"name\":\"mysafe01\",\"owner\":\"youremail@yourcompany.com\",\"type\":\"\",\"description\":\"My first safe\"}}";
    Response readResponse = getMockResponse(HttpStatus.NOT_FOUND, true, "");
    ResponseEntity<String> responseEntityExpected = ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("{\"errors\":[\"Error Fetching existing safe info. please check the path specified \"]}");
    Map<String,Object> reqparams = null;
    try {
        reqparams = new ObjectMapper().readValue(jsonStr, new TypeReference<Map<String, Object>>(){});
    } catch (IOException e) {
        e.printStackTrace();
    }
    when(ControllerUtil.parseJson(any())).thenReturn(reqparams);
    when(ControllerUtil.areSDBInputsValidForUpdate(reqparams)).thenReturn(true);
    when(ControllerUtil.getSafeName("shared/mysafe01")).thenReturn("mysafe01");
    when(ControllerUtil.getSafeType("shared/mysafe01")).thenReturn("shared");
    when(ControllerUtil.getCountOfSafesForGivenSafeName(safe.getSafeBasicDetails().getName(), token)).thenReturn(1);
    when(ControllerUtil.generateSafePath("mysafe01", "shared")).thenReturn("shared/mysafe01");
    when(ControllerUtil.isValidSafePath(any())).thenReturn(true);
    when(reqProcessor.process("/read","{\"path\":\"metadata/shared/mysafe01\"}",token)).thenReturn(readResponse);
    ResponseEntity<String> responseEntity = safesService.updateSafe(token, safe);
    assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, responseEntity.getStatusCode());
    assertEquals(responseEntityExpected, responseEntity);
}