@Test public void testIsSAMLAuthentication() { // given ServiceAccess mockServiceAccess = mock(ServiceAccess.class); ConfigurationService mockConfServ = mock(ConfigurationService.class); closedMplFilter.serviceAccess = mockServiceAccess; doReturn(mockConfServ).when(mockServiceAccess).getService(ConfigurationService.class); TenantService tenantMock = mock(TenantService.class); doReturn(tenantMock).when(mockServiceAccess).getService(TenantService.class); // when closedMplFilter.isSAMLAuthentication(); // then }