@@ -0,0 +1,2467 @@
+/*%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage org.trellisldp.http;%0A%0Aimport static java.util.Collections.emptyList;%0Aimport static org.mockito.ArgumentMatchers.any;%0Aimport static org.mockito.ArgumentMatchers.eq;%0Aimport static org.mockito.MockitoAnnotations.initMocks;%0Aimport static org.mockito.Mockito.when;%0Aimport static org.mockito.Mockito.verify;%0Aimport static org.trellisldp.http.domain.HttpConstants.SESSION_PROPERTY;%0A%0Aimport java.security.Principal;%0A%0Aimport javax.ws.rs.container.ContainerRequestContext;%0Aimport javax.ws.rs.core.SecurityContext;%0A%0Aimport org.junit.jupiter.api.BeforeEach;%0Aimport org.junit.jupiter.api.Test;%0Aimport org.junit.jupiter.api.TestInstance;%0Aimport org.junit.platform.runner.JUnitPlatform;%0Aimport org.junit.runner.RunWith;%0Aimport org.mockito.Mock;%0A%0Aimport org.trellisldp.api.AgentService;%0Aimport org.trellisldp.api.Session;%0Aimport org.trellisldp.vocabulary.Trellis;%0A%0A/**%0A * @author acoburn%0A */%0A@TestInstance(TestInstance.Lifecycle.PER_CLASS)%0A@RunWith(JUnitPlatform.class)%0Apublic class AgentAuthorizationFilterTest %7B%0A%0A    @Mock%0A    private AgentService mockAgentService;%0A%0A    @Mock%0A    private ContainerRequestContext mockContext;%0A%0A    @Mock%0A    private SecurityContext mockSecurityContext;%0A%0A    @Mock%0A    private Principal mockPrincipal;%0A%0A    @BeforeEach%0A    public void setUp() %7B%0A        initMocks(this);%0A        when(mockAgentService.asAgent(any())).thenReturn(Trellis.AnonymousUser);%0A        when(mockContext.getSecurityContext()).thenReturn(mockSecurityContext);%0A        when(mockSecurityContext.getUserPrincipal()).thenReturn(mockPrincipal);%0A    %7D%0A%0A    @Test%0A    public void testFilterMissingAgent() throws Exception %7B%0A        when(mockPrincipal.getName()).thenReturn(%22%22);%0A        final AgentAuthorizationFilter filter = new AgentAuthorizationFilter(mockAgentService, emptyList());%0A%0A        filter.filter(mockContext);%0A        verify(mockContext).setProperty(eq(SESSION_PROPERTY), any(Session.class));%0A    %7D%0A%7D%0A

Add more agent auth filter tests