@Test public void testCreateProvider() { prepareConfigurationForCreate(); //PROVIDER_ID don't exists by construction. when(providerConfiguration.getId()).thenReturn(PROVIDER_ID); service.createProvider(providerType, providerConfiguration); verify(runtimeProvisioningService, times(1)).registerProvider(providerConfig); }
@Test public void testCreateProvider() { prepareConfigurationForCreate(); //PROVIDER_ID don't exists by construction. when(providerConfiguration.getId()).thenReturn(PROVIDER_ID); service.createProvider(providerType, providerConfiguration); verify(runtimeProvisioningService, times(1)).registerProvider(providerConfig); }
@Test public void testCreateProviderExisting() { prepareConfigurationForCreate(); //emulate that one of the existing providers has the same id by picking an arbitrary existing id. String existingId = providers.get(1).getKey().getId(); when(providerConfiguration.getId()).thenReturn(existingId); expectedException.expectMessage("A provider with the given name already exists: " + existingId); service.createProvider(providerType, providerConfiguration); verify(runtimeProvisioningService, never()).registerProvider(any(ProviderConfig.class)); }
@Test public void testCreateProviderExisting() { prepareConfigurationForCreate(); //emulate that one of the existing providers has the same id by picking an arbitrary existing id. String existingId = providers.get(1).getKey().getId(); when(providerConfiguration.getId()).thenReturn(existingId); expectedException.expectMessage("A provider with the given name already exists: " + existingId); service.createProvider(providerType, providerConfiguration); verify(runtimeProvisioningService, never()).registerProvider(any(ProviderConfig.class)); }