/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.xwiki.resource.internal;

import org.junit.jupiter.api.Test;
import org.xwiki.resource.ResourceReference;

import static org.mockito.Mockito.mock;

/**
 * Unit tests for {@link DefaultResourceReferenceHandlerChain}.
 *
 * @version $Id$
 * @since 6.1M2
 */
class DefaultResourceReferenceHandlerChainTest
{
    @Test
    void executeNextWhenNoMoreAction() throws Exception
    {
        DefaultResourceReferenceHandlerChain chain = DefaultResourceReferenceHandlerChain.EMPTY;

        chain.handleNext(mock(ResourceReference.class));
    }
}

@@ -925,16 +925,41 @@
 ernal;%0A%0A
+import java.util.Queue;%0A%0A
 import o
@@ -1006,75 +1006,299 @@
 iki.
-resource.ResourceReference;%0A%0Aimport static org.mockito.Mockito.mock
+component.util.ReflectionUtils;%0Aimport org.xwiki.resource.ResourceReference;%0Aimport org.xwiki.resource.ResourceReferenceHandler;%0A%0Aimport static org.mockito.Mockito.mock;%0Aimport static org.mockito.Mockito.never;%0Aimport static org.mockito.Mockito.verify;%0Aimport static org.mockito.Mockito.when
 ;%0A%0A/
@@ -1626,63 +1626,376 @@
 TY;%0A
-%0A        chain.handleNext(mock(ResourceReference.class)
+        Queue%3CResourceReferenceHandler%3E queue = mock(Queue.class);%0A        when(queue.isEmpty()).thenReturn(true);%0A        ReflectionUtils.setFieldValue(chain, %22handlerStack%22, queue);%0A%0A        chain.handleNext(mock(ResourceReference.class));%0A%0A        // Verify that we don't get a ResourceReferenceHandler since the queue is empty.%0A        verify(queue, never()).poll(
 );%0A 

Make sure we always have an assertion in a unit test