DDMDataProviderInvokerImpl implements DDMDataProviderInvoker { protected DDMDataProviderResponse doInvokeExternal( DDMDataProviderInstance ddmDataProviderInstance, DDMDataProvider ddmDataProvider, DDMDataProviderRequest ddmDataProviderRequest) { DDMDataProviderInvokeCommand ddmDataProviderInvokeCommand = new DDMDataProviderInvokeCommand( ddmDataProviderInstance.getNameCurrentValue(), ddmDataProvider, ddmDataProviderRequest, ddmDataProviderInstanceSettings.getSettings( ddmDataProviderInstance, DDMRESTDataProviderSettings.class)); return ddmDataProviderInvokeCommand.execute(); }  @Override DDMDataProviderResponse invoke(
		DDMDataProviderRequest ddmDataProviderRequest);  }
@Test public void testDoInvokeExternal() throws Exception { DDMDataProviderInvokerImpl ddmDataProviderInvokerImpl = mock( DDMDataProviderInvokerImpl.class); DDMDataProviderRequest.Builder builder = DDMDataProviderRequest.Builder.newBuilder(); DDMDataProviderRequest ddmDataProviderRequest = builder.withDDMDataProviderId( "1" ).build(); DDMDataProviderInstance ddmDataProviderInstance = mock( DDMDataProviderInstance.class); Optional<DDMDataProviderInstance> optional = Optional.of( ddmDataProviderInstance); when( ddmDataProviderInvokerImpl.fetchDDMDataProviderInstanceOptional("1") ).thenReturn( optional ); DDMDataProvider ddmDataProvider = mock(DDMDataProvider.class); when( ddmDataProviderInvokerImpl.getDDMDataProvider("1", optional) ).thenReturn( ddmDataProvider ); DDMDataProviderResponse.Builder responseBuilder = DDMDataProviderResponse.Builder.newBuilder(); when( ddmDataProviderInvokerImpl.doInvokeExternal( ddmDataProviderInstance, ddmDataProvider, ddmDataProviderRequest) ).thenReturn( responseBuilder.withOutput( "test", "value" ).build() ); when( ddmDataProviderInvokerImpl.doInvoke(ddmDataProviderRequest) ).thenCallRealMethod(); DDMDataProviderResponse ddmDataProviderResponse = ddmDataProviderInvokerImpl.doInvoke(ddmDataProviderRequest); Optional<String> outputOptional = ddmDataProviderResponse.getOutputOptional("test", String.class); Assert.assertEquals("value", outputOptional.get()); }