Skip to content

Commit

Permalink
Test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
djtfmartin committed Sep 23, 2024
1 parent 73fab94 commit ba33a44
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@
import org.gbif.occurrence.common.config.OccHBaseConfiguration;
import org.gbif.occurrence.download.service.CallbackService;
import org.gbif.occurrence.download.service.DownloadRequestServiceImpl;
import org.gbif.occurrence.search.configuration.NameUsageMatchServiceTriage;
import org.gbif.occurrence.search.es.EsConfig;
import org.gbif.occurrence.search.es.OccurrenceBaseEsFieldMapper;
import org.gbif.occurrence.search.es.OccurrenceEsField;
import org.gbif.occurrence.test.mocks.*;
import org.gbif.occurrence.test.servers.EsManageServer;
import org.gbif.occurrence.test.servers.HBaseServer;
import org.gbif.occurrence.ws.config.ChecklistAwareSearchRequestHandlerMethodArgumentResolver;
import org.gbif.occurrence.ws.config.WebMvcConfig;
import org.gbif.vocabulary.client.ConceptClient;
import org.gbif.ws.remoteauth.IdentityServiceClient;
Expand Down Expand Up @@ -160,6 +162,11 @@ public NameUsageMatchingService nameUsageMatchingService() {
return Mockito.mock(NameUsageMatchingService.class);
}

@Bean
public NameUsageMatchServiceTriage nameUsageMatchServiceTriage() {
return Mockito.mock(NameUsageMatchServiceTriage.class);
}

/** Mock service to interact with the Registry. */
@Bean
@ConditionalOnProperty(name = "api.url", matchIfMissing = true)
Expand All @@ -174,6 +181,13 @@ public CallbackService downloadCallbackService(
return new DownloadCallbackServiceMock(occurrenceDownloadService);
}

@Bean
public ChecklistAwareSearchRequestHandlerMethodArgumentResolver checklistAwareSearchRequestHandlerMethodArgumentResolver(
NameUsageMatchServiceTriage triage
) {
return new ChecklistAwareSearchRequestHandlerMethodArgumentResolver(triage);
}

/** Creates a DownloadRequestService using the available mock instances. */
@Bean
public DownloadRequestService downloadRequestService(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
public class ChecklistAwareSearchRequestHandlerMethodArgumentResolver
extends OccurrenceSearchRequestHandlerMethodArgumentResolver {

@Autowired
protected NameUsageMatchServiceTriage triage;
protected final NameUsageMatchServiceTriage triage;

public ChecklistAwareSearchRequestHandlerMethodArgumentResolver() {
public ChecklistAwareSearchRequestHandlerMethodArgumentResolver(NameUsageMatchServiceTriage triage) {
super();
this.triage = triage;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void searchParametersDocumented() throws Exception {
for (OccurrenceSearchParameter param : OccurrenceSearchParameter.values()) {
String name = null;
if (param.equals(OccurrenceSearchParameter.IDENTIFIED_BY_ID)) {
// do nothing
name = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, param.name()).replace("Id", "ID");
} else if (param.equals(OccurrenceSearchParameter.RECORDED_BY_ID)) {
name = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, param.name()).replace("Id", "ID");
} else {
Expand Down

0 comments on commit ba33a44

Please sign in to comment.