@Test
public void shouldProvideActionDefinition() {
@SuppressWarnings({"unchecked", "rawtypes"})
final Class<Entity<Map<String, Object>>> entityType = (Class) Entity.class;
ArgumentCaptor.forClass(entityType);
final DynamicActionMetadata suggestions = new DynamicActionMetadata.Builder()
.putProperty("sObjectName", Arrays.asList(DynamicActionMetadata.ActionPropertySuggestion.Builder.of("Account", "Account"),
DynamicActionMetadata.ActionPropertySuggestion.Builder.of("Contact", "Contact")))
.build();
when(metadataCommand.execute()).thenReturn(suggestions);
when(((HystrixInvokableInfo<?>) metadataCommand).isSuccessfulExecution()).thenReturn(true);
final Response response = handler.enrichWithMetadata(SALESFORCE_CREATE_OR_UPDATE, Collections.emptyMap());
assertThat(response.getStatus()).isEqualTo(Status.OK.getStatusCode());
@SuppressWarnings("unchecked")
final Meta<ConnectorDescriptor> meta = (Meta<ConnectorDescriptor>) response.getEntity();
final ConnectorDescriptor enrichedDefinitioin = new ConnectorDescriptor.Builder()
.createFrom(createOrUpdateSalesforceObjectDescriptor)
.replaceConfigurationProperty("sObjectName",
c -> c.addEnum(ConfigurationProperty.PropertyValue.Builder.of("Account", "Account"),
ConfigurationProperty.PropertyValue.Builder.of("Contact", "Contact")))
.inputDataShape(ConnectionActionHandler.ANY_SHAPE)
.build();
assertThat(meta.getValue()).isEqualTo(enrichedDefinitioin);
}