    @Test
    public void testAppliesToPreferenceMatch() {


        final IPortletDescriptorKey portletDescriptorKey = mock(IPortletDescriptorKey.class);
        when(portletDescriptorKey.getPortletName()).thenAnswer(invocation -> NOT_A_MATCH);
        when(portletDescriptorKey.getWebAppName()).thenAnswer(invocation -> NOT_A_MATCH);

        final IPortletPreference portletPreference = mock(IPortletPreference.class);
        when(portletPreference.getName()).thenAnswer(invocation -> PREFERENCE_NAME);

        final IPortletDefinition portletDefinition = mock(IPortletDefinition.class);
        when(portletDefinition.getPortletDescriptorKey())
                .thenAnswer(invocation -> portletDescriptorKey);
        when(portletDefinition.getPortletPreferences())
                .thenAnswer(invocation -> Collections.singletonList(portletPreference));

        assertFalse(EXTRACTOR.appliesTo(portletDefinition));
    }