Skip to content
Snippets Groups Projects
Commit 9dcb40a3 authored by MZhu9's avatar MZhu9
Browse files

refactor unit tests

parent 45b07260
No related branches found
No related tags found
1 merge request!556Implement reindex records API
Pipeline #191761 failed
......@@ -92,7 +92,7 @@ public class ReindexApiTest {
ResponseEntity<?> response = sut.reindexRecords(new ReindexRecordsRequest(recordIds));
assertEquals(HttpStatus.ACCEPTED, response.getStatusCode());
verify(auditLogger).getReindex(any());
verify(auditLogger).getReindexRecords(any());
}
@Test
......
......@@ -190,14 +190,16 @@ public class StorageServiceImplTest {
@Test
public void should_returnStorageRecords_givenRecordIds_getValidStorageRecordsTest() throws URISyntaxException {
String validDataFromStorage = "{\"records\":[{\"id\":\"testid\", \"version\":1, \"kind\":\"tenant:test:test:1.0.0\"}],\"notFound\":[\"invalid1\"], \"conversionStatuses\": []}";
String validDataFromStorage = "{\"records\":[{\"id\":\"tenant1:doc:1dbf528e0e0549cab7a08f29fbfc8465\", \"version\":1, \"kind\":\"tenant:test:test:1.0.0\"}]}";
HttpResponse httpResponse = mock(HttpResponse.class);
when(httpResponse.getBody()).thenReturn(validDataFromStorage);
when(configurationProperties.getStorageQueryRecordForConversionHost()).thenReturn("storageUrl");
when(configurationProperties.getStorageQueryRecordHost()).thenReturn("storageUrl");
when(this.httpClientHandler.sendRequest(any(), any())).thenReturn(httpResponse);
Records storageRecords = this.sut.getStorageRecords(ids);
List<String> idsCopy = new ArrayList<>();
idsCopy.addAll(ids);
Records storageRecords = this.sut.getStorageRecords(idsCopy);
assertEquals(1, storageRecords.getRecords().size());
assertEquals(1, storageRecords.getNotFound().size());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment