### Question:
AddressStorageService extends EntityStorageService { public ResponseEntity<IResponse> retrieveMultipleObjectsFromStorage(GetHistoryAddressesRequest getHistoryAddressesRequest) { try { if (!getHistoryAddressesRequestCrypto.verifySignature(getHistoryAddressesRequest)) { return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body(new SerializableResponse(INVALID_SIGNATURE, STATUS_ERROR)); } Map<Hash, AddressData> hashToAddressDataMap = new HashMap<>(); super.retrieveMultipleObjectsFromStorage(getHistoryAddressesRequest.getAddressHashes()).forEach((hash, addressString) -> hashToAddressDataMap.put(hash, addressString != null ? jacksonSerializer.deserialize(addressString) : null)); GetHistoryAddressesResponse getHistoryAddressesResponse = new GetHistoryAddressesResponse(hashToAddressDataMap); getHistoryAddressesResponseCrypto.signMessage(getHistoryAddressesResponse); return ResponseEntity.ok(getHistoryAddressesResponse); } catch (Exception e) { return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(new SerializableResponse(e.getMessage(), STATUS_ERROR)); } }  @PostConstruct void init(); ResponseEntity<IResponse> retrieveMultipleObjectsFromStorage(GetHistoryAddressesRequest getHistoryAddressesRequest); boolean validateObjectDataIntegrity(Hash addressHash, String addressAsJson); Map<Hash, AddressData> getObjectsMapFromJsonMap(Map<Hash, String> responsesMap);  }### Answer:
@Test public void retrieveMultipleObjectsFromStorage_badSignature_errorReturned() { GetHistoryAddressesRequest getHistoryAddressesRequest = AddressTestUtils.generateGetHistoryAddressesRequest( null, null, addressDataInStorage1); when(getHistoryAddressesRequestCrypto.verifySignature(getHistoryAddressesRequest)).thenReturn(false); ResponseEntity<IResponse> actualResponse = addressStorageService.retrieveMultipleObjectsFromStorage(getHistoryAddressesRequest); SerializableResponse expectedResponse = new SerializableResponse(INVALID_SIGNATURE, STATUS_ERROR); Assert.assertEquals(expectedResponse, actualResponse.getBody()); }
@Test public void retrieveMultipleObjectsFromStorage_addressesInStorage_returnsAddresses() { GetHistoryAddressesRequest getHistoryAddressesRequest = AddressTestUtils.generateGetHistoryAddressesRequest( null, null, addressDataInStorage1, addressDataInStorage2); when(getHistoryAddressesRequestCrypto.verifySignature(getHistoryAddressesRequest)).thenReturn(true); mockGetMultiObjectsFromDb(true, ElasticSearchData.ADDRESSES, generateInStorageList(Boolean.TRUE, Boolean.TRUE), addressDataInStorage1, addressDataInStorage2); mockGetMultiObjectsFromDb(false, ElasticSearchData.ADDRESSES, generateInStorageList(Boolean.TRUE, Boolean.TRUE), addressDataInStorage1, addressDataInStorage2); ResponseEntity<IResponse> actualResponse = addressStorageService.retrieveMultipleObjectsFromStorage(getHistoryAddressesRequest); ResponseEntity<IResponse> expectedResponse = generateExpectedResponse(generateInStorageList(Boolean.TRUE, Boolean.TRUE), addressDataInStorage1, addressDataInStorage2); checkResponseEquality(expectedResponse, actualResponse); }
@Test public void retrieveMultipleObjectsFromStorage_addressesNotInStorage_returnsNulls() { GetHistoryAddressesRequest getHistoryAddressesRequest = AddressTestUtils.generateGetHistoryAddressesRequest( null, null, addressDataNotInStorage1, addressDataNotInStorage2); when(getHistoryAddressesRequestCrypto.verifySignature(getHistoryAddressesRequest)).thenReturn(true); mockGetMultiObjectsFromDb(true, ElasticSearchData.ADDRESSES, generateInStorageList(Boolean.FALSE, Boolean.FALSE), addressDataNotInStorage1, addressDataNotInStorage2); mockGetMultiObjectsFromDb(false, ElasticSearchData.ADDRESSES, generateInStorageList(Boolean.FALSE, Boolean.FALSE), addressDataNotInStorage1, addressDataNotInStorage2); ResponseEntity<IResponse> actualResponse = addressStorageService.retrieveMultipleObjectsFromStorage(getHistoryAddressesRequest); ResponseEntity<IResponse> expectedResponse = generateExpectedResponse(generateInStorageList(Boolean.FALSE, Boolean.FALSE), addressDataNotInStorage1, addressDataNotInStorage2); checkResponseEquality(expectedResponse, actualResponse); }