    @Test
    public void testExecute_WhenElementIdMatches_UpdateNotNeeded() throws Exception {

        // Arrange.
        SecurityGroup sg = registerSecurityGroup(1L, "projectId", "projectName", 1L, "sgName");
        sg.addSecurityGroupMember(newSGMWithPort(1L, OPENSTACK_ID));
        NetworkElementImpl portGroup = createPortGroup(OPENSTACK_ID);

        ostRegisterPorts(sg);

        String domainId = UUID.randomUUID().toString();
        registerDomain(domainId, sg);

        NetworkElement ne = createNetworkElement(OPENSTACK_ID);

        SdnRedirectionApi redirectionApi = registerNetworkElement(portGroup, ne);
        registerNetworkRedirectionApi(redirectionApi, sg.getVirtualizationConnector());

        UpdatePortGroupTask task = this.factoryTask.create(sg, portGroup);

        // Act.
        task.execute();

        // Assert.
        verify(this.em, Mockito.never()).merge(any());
    }