@Test
public void validateShouldThrowExceptionWhenTwoConnectorsHaveTheSameName() {

    //given
    ConnectorDefinition connectorDefinition = new ConnectorDefinition();
    connectorDefinition.setName("Conflicting name connector");
    ConnectorDefinition connectorDefinitionWithSameName = new ConnectorDefinition();
    connectorDefinitionWithSameName.setName("Conflicting name connector");
    //when
    Throwable throwable = catchThrowable(
            () -> connectorDefinitionService.validate(Arrays.asList(connectorDefinition,
                                                             connectorDefinitionWithSameName))
    );
    //then
    assertThat(throwable)
            .isInstanceOf(IllegalStateException.class)
            .hasMessage("More than one connectorDefinition with name '" + connectorDefinition.getName() + "' was found. Names must be unique.");
}