public static boolean objectWithTheSameNameExists( SharedObjectInterface object,
      Collection<? extends SharedObjectInterface> scope ) {
    for ( SharedObjectInterface element : scope ) {
      String elementName = element.getName();
      if ( elementName != null && elementName.equalsIgnoreCase( object.getName() ) && object != element ) {
        return true;
      }
    }
    return false;
  }
@Test
  public void objectWithTheSameNameExists_false_if_same_object() {
    SharedObjectInterface sharedObject = mock( SharedObjectInterface.class );
    when( sharedObject.getName() ).thenReturn( "TEST_OBJECT" );

    assertFalse( objectWithTheSameNameExists( sharedObject, Collections.singleton( sharedObject ) ) );
  }