use of ddf.catalog.core.versioning.DeletedMetacard in project ddf by codice.
the class HistorianTest method mockQuery.
private void mockQuery(Metacard metacard) throws UnsupportedQueryException {
SourceResponse sourceResponse = mock(SourceResponse.class);
Result result = mock(Result.class);
when(result.getMetacard()).thenReturn(metacard);
Result noResult = mock(Result.class);
Result deletedResult = mock(Result.class);
DeletedMetacard deletedMetacard = mock(DeletedMetacard.class);
when(deletedMetacard.getId()).thenReturn(DELETED_METACARD_ID);
when(deletedMetacard.getMetacardType()).thenReturn(DeletedMetacardImpl.getDeletedMetacardType());
when(deletedResult.getMetacard()).thenReturn(deletedMetacard);
Result notVersionedResult = mock(Result.class);
Metacard versionedMetacard = mock(MetacardVersion.class);
when(versionedMetacard.getId()).thenReturn(VERSIONED_METACARD_ID);
when(versionedMetacard.getMetacardType()).thenReturn(MetacardVersionImpl.getMetacardVersionType());
when(notVersionedResult.getMetacard()).thenReturn(versionedMetacard);
when(sourceResponse.getResults()).thenReturn(Arrays.asList(deletedResult, result, noResult, notVersionedResult));
when(catalogProvider.query(any())).thenReturn(sourceResponse);
}
Aggregations